Search in sources :

Example 1 with Deferred

use of com.google.firebase.inject.Deferred in project firebase-android-sdk by firebase.

the class CrashlyticsNativeComponentDeferredProxyTest method testProviderProxyCallsThroughProvidedValue.

@Test
public void testProviderProxyCallsThroughProvidedValue() {
    CrashlyticsNativeComponentDeferredProxy proxy = new CrashlyticsNativeComponentDeferredProxy(new Deferred<CrashlyticsNativeComponent>() {

        @Override
        public void whenAvailable(@NonNull Deferred.DeferredHandler<CrashlyticsNativeComponent> handler) {
            handler.handle(() -> component);
        }
    });
    proxy.hasCrashDataForSession(TEST_SESSION_ID);
    Mockito.verify(component, Mockito.times(1)).hasCrashDataForSession(eq(TEST_SESSION_ID));
    StaticSessionData.AppData appData = StaticSessionData.AppData.create("appId", "123", "1.2.3", "install_id", 0, mock(DevelopmentPlatformProvider.class));
    StaticSessionData.OsData osData = StaticSessionData.OsData.create("release", "codeName", false);
    StaticSessionData.DeviceData deviceData = StaticSessionData.DeviceData.create(0, "model", 1, 1000, 2000, false, 0, "manufacturer", "modelClass");
    StaticSessionData sessionData = StaticSessionData.create(appData, osData, deviceData);
    proxy.prepareNativeSession(TEST_SESSION_ID, TEST_GENERATOR, TEST_START_TIME, sessionData);
    Mockito.verify(component, Mockito.times(1)).prepareNativeSession(eq(TEST_SESSION_ID), eq(TEST_GENERATOR), eq(TEST_START_TIME), eq(sessionData));
    proxy.getSessionFileProvider(TEST_SESSION_ID);
    Mockito.verify(component, Mockito.times(1)).getSessionFileProvider(eq(TEST_SESSION_ID));
}
Also used : Deferred(com.google.firebase.inject.Deferred) StaticSessionData(com.google.firebase.crashlytics.internal.model.StaticSessionData) Test(org.junit.Test)

Aggregations

StaticSessionData (com.google.firebase.crashlytics.internal.model.StaticSessionData)1 Deferred (com.google.firebase.inject.Deferred)1 Test (org.junit.Test)1