Skip to content

Commit 3affca2

Browse files
committed
Add test for verification of no event in android M after onPause-onResume
1 parent f37d54d commit 3affca2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

permission-flow/src/test/java/dev/shreyaspatil/permissionFlow/internal/ApplicationStateMonitorTest.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,19 @@ class ApplicationStateMonitorTest {
301301
}
302302
}
303303

304+
@Test
305+
@Config(sdk = [Build.VERSION_CODES.M])
306+
fun shouldNotEmitEvent_whenActivityIsResumedAfterPaused_onAndroidM() = runTest {
307+
monitor.activityForegroundEvents.test {
308+
// Before onStart(), onStop() should be called first
309+
lifecycleCallbacks.onActivityPaused(mockk())
310+
lifecycleCallbacks.onActivityResumed(mockk())
311+
312+
// Event should get emitted
313+
expectNoEvents()
314+
}
315+
}
316+
304317
@Test
305318
@Config(sdk = [Build.VERSION_CODES.N])
306319
fun shouldNotEmitEvent_whenActivityIsResumedButStillInMultiWindowMode() = runTest {

0 commit comments

Comments
 (0)