Skip to content

Commit fb07663

Browse files
committed
Feedback
1 parent 6c01dea commit fb07663

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

firebase-sessions/src/test/kotlin/com/google/firebase/sessions/api/CrashEventReceiverTest.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ class CrashEventReceiverTest {
9292
assertThat(sharedSessionRepository.isInForeground).isFalse()
9393

9494
// This will not update background time since the process is already in the background
95+
val originalBackgroundTime = fakeTimeProvider.currentTime()
9596
CrashEventReceiver.notifyCrashOccurred()
9697
assertThat(sharedSessionRepository.localSessionData.backgroundTime)
97-
.isEqualTo(fakeTimeProvider.currentTime())
98+
.isEqualTo(originalBackgroundTime)
9899

99100
// Wait a bit, then bring the process to foreground
100101
fakeTimeProvider.addInterval(31.minutes)
@@ -107,13 +108,13 @@ class CrashEventReceiverTest {
107108

108109
// Wait a bit, then notify of a crash
109110
fakeTimeProvider.addInterval(3.seconds)
111+
val newBackgroundTime = fakeTimeProvider.currentTime()
110112
CrashEventReceiver.notifyCrashOccurred()
111113

112114
runCurrent()
113115

114116
// Verify the background time got updated
115-
assertThat(sharedSessionRepository.localSessionData.backgroundTime)
116-
.isEqualTo(fakeTimeProvider.currentTime())
117+
assertThat(sharedSessionRepository.localSessionData.backgroundTime).isEqualTo(newBackgroundTime)
117118

118119
// Clean up
119120
fakeDataStore.close()

0 commit comments

Comments
 (0)