use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport in project firebase-android-sdk by firebase.
the class CrashlyticsReportPersistenceTest method testLoadFinalizedReports_reportThenEvent_returnsReportWithEvent.
public void testLoadFinalizedReports_reportThenEvent_returnsReportWithEvent() {
final String sessionId = "testSession";
final CrashlyticsReport testReport = makeTestReport(sessionId);
final CrashlyticsReport.Session.Event testEvent = makeTestEvent();
reportPersistence.persistReport(testReport);
reportPersistence.persistEvent(testEvent, sessionId);
final long endedAt = System.currentTimeMillis();
reportPersistence.finalizeReports("skippedSession", endedAt);
final List<CrashlyticsReportWithSessionId> finalizedReports = reportPersistence.loadFinalizedReports();
assertEquals(1, finalizedReports.size());
final CrashlyticsReport finalizedReport = finalizedReports.get(0).getReport();
assertEquals(testReport.withSessionEndFields(endedAt, false, null).withEvents(ImmutableList.from(testEvent)), finalizedReport);
}
use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport in project firebase-android-sdk by firebase.
the class CrashlyticsReportPersistenceTest method testHasFinalizedReports.
public void testHasFinalizedReports() {
final String sessionId = "testSession";
final CrashlyticsReport testReport = makeTestReport(sessionId);
final CrashlyticsReport.Session.Event testEvent = makeTestEvent();
reportPersistence.persistReport(testReport);
reportPersistence.persistEvent(testEvent, sessionId);
final long endedAt = System.currentTimeMillis();
reportPersistence.finalizeReports("skippedSession", endedAt);
assertTrue(reportPersistence.hasFinalizedReports());
}
use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport in project firebase-android-sdk by firebase.
the class CrashlyticsReportPersistenceTest method testDeleteFinalizedReport_removesReports.
public void testDeleteFinalizedReport_removesReports() {
final String sessionId = "testSession";
final CrashlyticsReport testReport = makeTestReport(sessionId);
final CrashlyticsReport.Session.Event testEvent = makeTestEvent();
reportPersistence.persistReport(testReport);
reportPersistence.persistEvent(testEvent, sessionId);
reportPersistence.finalizeReports("skippedSession", 0L);
assertEquals(1, reportPersistence.loadFinalizedReports().size());
fileStore.getReport(sessionId).delete();
assertEquals(0, reportPersistence.loadFinalizedReports().size());
}
use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport in project firebase-android-sdk by firebase.
the class CrashlyticsReportPersistenceTest method testPersistReportWithAnrEvent.
public void testPersistReportWithAnrEvent() throws IOException {
reportPersistence = new CrashlyticsReportPersistence(fileStore, createSettingsProviderMock(VERY_LARGE_UPPER_LIMIT, 4));
final String sessionId = "testSession";
final CrashlyticsReport testReport = makeTestReport(sessionId);
final Event testEvent = makeTestAnrEvent();
reportPersistence.persistReport(testReport);
reportPersistence.persistEvent(testEvent, sessionId, true);
final long endedAt = System.currentTimeMillis();
reportPersistence.finalizeReports("skippedSession", endedAt);
final List<CrashlyticsReportWithSessionId> finalizedReports = reportPersistence.loadFinalizedReports();
assertEquals(1, finalizedReports.size());
final CrashlyticsReport finalizedReport = finalizedReports.get(0).getReport();
assertEquals(1, finalizedReport.getSession().getEvents().size());
}
use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport in project firebase-android-sdk by firebase.
the class CrashlyticsReportPersistenceTest method testPersistReports_getStartTimestampMillis.
public void testPersistReports_getStartTimestampMillis() {
final String sessionId = "testSession";
final CrashlyticsReport testReport = makeTestReport(sessionId);
reportPersistence.persistReport(testReport);
assertEquals(testReport.getSession().getStartedAt() * 1000, reportPersistence.getStartTimestampMillis(sessionId));
}
Aggregations