Search in sources :

Example 11 with CrashlyticsReport

use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport in project firebase-android-sdk by firebase.

the class CrashlyticsReportDataCaptureTest method testCaptureReportSessionFields.

@Test
public void testCaptureReportSessionFields() {
    final String sessionId = "sessionId";
    final long timestamp = System.currentTimeMillis();
    final CrashlyticsReport report = dataCapture.captureReportData(sessionId, timestamp);
    assertEquals(sessionId, report.getSession().getIdentifier());
    assertEquals(timestamp, report.getSession().getStartedAt());
    assertEquals(GENERATOR, report.getSession().getGenerator());
    assertEquals(GENERATOR_TYPE, report.getSession().getGeneratorType());
}
Also used : CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport) Test(org.junit.Test)

Example 12 with CrashlyticsReport

use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport in project firebase-android-sdk by firebase.

the class SessionReportingCoordinatorTest method mockReport.

private static CrashlyticsReport mockReport(String sessionId) {
    final CrashlyticsReport mockReport = mock(CrashlyticsReport.class);
    final CrashlyticsReport.Session mockSession = mock(CrashlyticsReport.Session.class);
    when(mockSession.getIdentifier()).thenReturn(sessionId);
    when(mockReport.getSession()).thenReturn(mockSession);
    return mockReport;
}
Also used : CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport)

Example 13 with CrashlyticsReport

use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport in project firebase-android-sdk by firebase.

the class CrashlyticsReportJsonTransformTest method testReportToJsonAndBack_equals.

@Test
public void testReportToJsonAndBack_equals() throws IOException {
    final CrashlyticsReport testReport = makeTestReport(false);
    final String testReportJson = transform.reportToJson(testReport);
    final CrashlyticsReport reifiedReport = transform.reportFromJson(testReportJson);
    assertNotSame(reifiedReport, testReport);
    assertEquals(reifiedReport, testReport);
}
Also used : CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport) Test(org.junit.Test)

Example 14 with CrashlyticsReport

use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport in project firebase-android-sdk by firebase.

the class CrashlyticsReportJsonTransformTest method testReportToJsonAndBack_with_developmentPlatform_equals.

@Test
public void testReportToJsonAndBack_with_developmentPlatform_equals() throws IOException {
    final CrashlyticsReport testReport = makeTestReport(true);
    final String testReportJson = transform.reportToJson(testReport);
    final CrashlyticsReport reifiedReport = transform.reportFromJson(testReportJson);
    assertNotSame(reifiedReport, testReport);
    assertEquals(reifiedReport, testReport);
}
Also used : CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport) Test(org.junit.Test)

Example 15 with CrashlyticsReport

use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport in project firebase-android-sdk by firebase.

the class CrashlyticsReportPersistenceTest method testLoadFinalizedReports_reportWithUserId_returnsReportWithProperUserId.

public void testLoadFinalizedReports_reportWithUserId_returnsReportWithProperUserId() {
    final String sessionId = "testSession";
    final String userId = "testUser";
    final CrashlyticsReport testReport = makeTestReport(sessionId, userId);
    final CrashlyticsReport.Session.Event testEvent = makeTestEvent();
    reportPersistence.persistReport(testReport);
    reportPersistence.persistEvent(testEvent, sessionId);
    reportPersistence.finalizeReports("skippedSession", 0L);
    final List<CrashlyticsReportWithSessionId> finalizedReports = reportPersistence.loadFinalizedReports();
    assertEquals(1, finalizedReports.size());
    final CrashlyticsReport finalizedReport = finalizedReports.get(0).getReport();
    assertNotNull(finalizedReport.getSession().getUser());
    assertEquals(userId, finalizedReport.getSession().getUser().getIdentifier());
}
Also used : CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport) CrashlyticsReportWithSessionId(com.google.firebase.crashlytics.internal.common.CrashlyticsReportWithSessionId) Event(com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.Event) Session(com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session)

Aggregations

CrashlyticsReport (com.google.firebase.crashlytics.internal.model.CrashlyticsReport)34 CrashlyticsReportWithSessionId (com.google.firebase.crashlytics.internal.common.CrashlyticsReportWithSessionId)13 Session (com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session)13 Event (com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.Event)13 IOException (java.io.IOException)8 File (java.io.File)6 Test (org.junit.Test)5 Logger (com.google.firebase.crashlytics.internal.Logger)4 NonNull (androidx.annotation.NonNull)2 TaskCompletionSource (com.google.android.gms.tasks.TaskCompletionSource)2 ArrayList (java.util.ArrayList)2 JsonReader (android.util.JsonReader)1 Settings (com.google.firebase.crashlytics.internal.settings.Settings)1 FeatureFlagData (com.google.firebase.crashlytics.internal.settings.Settings.FeatureFlagData)1 SettingsProvider (com.google.firebase.crashlytics.internal.settings.SettingsProvider)1 StringReader (java.io.StringReader)1