Search in sources :

Example 1 with TestSettings

use of com.google.firebase.crashlytics.internal.settings.TestSettings in project firebase-android-sdk by firebase.

the class CrashlyticsControllerTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    testContext = getContext();
    FirebaseInstallationsApi installationsApiMock = mock(FirebaseInstallationsApi.class);
    when(installationsApiMock.getId()).thenReturn(Tasks.forResult("instanceId"));
    idManager = new IdManager(testContext, testContext.getPackageName(), installationsApiMock, DataCollectionArbiterTest.MOCK_ARBITER_ENABLED);
    testFileStore = new FileStore(testContext);
    Settings testSettings = new TestSettings(3);
    mockSessionReportingCoordinator = mock(SessionReportingCoordinator.class);
    mockDataCollectionArbiter = mock(DataCollectionArbiter.class);
    when(mockDataCollectionArbiter.isAutomaticDataCollectionEnabled()).thenReturn(true);
    testSettingsProvider = mock(SettingsProvider.class);
    when(testSettingsProvider.getSettingsSync()).thenReturn(testSettings);
    when(testSettingsProvider.getSettingsAsync()).thenReturn(Tasks.forResult(testSettings));
}
Also used : SettingsProvider(com.google.firebase.crashlytics.internal.settings.SettingsProvider) FileStore(com.google.firebase.crashlytics.internal.persistence.FileStore) TestSettings(com.google.firebase.crashlytics.internal.settings.TestSettings) FirebaseInstallationsApi(com.google.firebase.installations.FirebaseInstallationsApi) TestSettings(com.google.firebase.crashlytics.internal.settings.TestSettings) Settings(com.google.firebase.crashlytics.internal.settings.Settings)

Example 2 with TestSettings

use of com.google.firebase.crashlytics.internal.settings.TestSettings in project firebase-android-sdk by firebase.

the class CrashlyticsCoreInitializationTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    mockAppContext = newMockContext();
    mockResources = mock(Resources.class);
    testFirebaseOptions = new FirebaseOptions.Builder().setApplicationId(GOOGLE_APP_ID).build();
    fileStore = new FileStore(getContext());
    mockSettingsController = mock(SettingsController.class);
    Settings settings = new TestSettings();
    when(mockSettingsController.getSettingsSync()).thenReturn(settings);
    when(mockSettingsController.getSettingsAsync()).thenReturn(Tasks.forResult(settings));
}
Also used : FileStore(com.google.firebase.crashlytics.internal.persistence.FileStore) TestSettings(com.google.firebase.crashlytics.internal.settings.TestSettings) Resources(android.content.res.Resources) FirebaseOptions(com.google.firebase.FirebaseOptions) TestSettings(com.google.firebase.crashlytics.internal.settings.TestSettings) Settings(com.google.firebase.crashlytics.internal.settings.Settings) SettingsController(com.google.firebase.crashlytics.internal.settings.SettingsController)

Example 3 with TestSettings

use of com.google.firebase.crashlytics.internal.settings.TestSettings in project firebase-android-sdk by firebase.

the class CrashlyticsCoreTest method startCoreAsync.

// Starts the given CrashlyticsCore.
private Task<CrashlyticsCore> startCoreAsync(CrashlyticsCore crashlyticsCore) {
    // Swallow exceptions so tests don't crash.
    Thread.setDefaultUncaughtExceptionHandler(NOOP_HANDLER);
    SettingsController mockSettingsController = mock(SettingsController.class);
    final Settings settings = new TestSettings(3);
    when(mockSettingsController.getSettingsSync()).thenReturn(settings);
    when(mockSettingsController.getSettingsAsync()).thenReturn(Tasks.forResult(settings));
    AppData appData = new AppData(GOOGLE_APP_ID, "buildId", "installerPackageName", "packageName", "versionCode", "versionName", mock(DevelopmentPlatformProvider.class));
    crashlyticsCore.onPreExecute(appData, mockSettingsController);
    return crashlyticsCore.doBackgroundInitializationAsync(mockSettingsController).onSuccessTask(new SuccessContinuation<Void, CrashlyticsCore>() {

        @NonNull
        @Override
        public Task<CrashlyticsCore> then(@Nullable Void aVoid) throws Exception {
            return Tasks.forResult(crashlyticsCore);
        }
    });
}
Also used : Task(com.google.android.gms.tasks.Task) DevelopmentPlatformProvider(com.google.firebase.crashlytics.internal.DevelopmentPlatformProvider) TestSettings(com.google.firebase.crashlytics.internal.settings.TestSettings) NonNull(androidx.annotation.NonNull) TestSettings(com.google.firebase.crashlytics.internal.settings.TestSettings) Settings(com.google.firebase.crashlytics.internal.settings.Settings) SettingsController(com.google.firebase.crashlytics.internal.settings.SettingsController)

Aggregations

Settings (com.google.firebase.crashlytics.internal.settings.Settings)3 TestSettings (com.google.firebase.crashlytics.internal.settings.TestSettings)3 FileStore (com.google.firebase.crashlytics.internal.persistence.FileStore)2 SettingsController (com.google.firebase.crashlytics.internal.settings.SettingsController)2 Resources (android.content.res.Resources)1 NonNull (androidx.annotation.NonNull)1 Task (com.google.android.gms.tasks.Task)1 FirebaseOptions (com.google.firebase.FirebaseOptions)1 DevelopmentPlatformProvider (com.google.firebase.crashlytics.internal.DevelopmentPlatformProvider)1 SettingsProvider (com.google.firebase.crashlytics.internal.settings.SettingsProvider)1 FirebaseInstallationsApi (com.google.firebase.installations.FirebaseInstallationsApi)1