diff options
| author | 2024-10-25 18:40:42 +0000 | |
|---|---|---|
| committer | 2024-10-28 19:12:23 +0000 | |
| commit | 9480c4e7654d8afb13bb854504562c08f36fce2f (patch) | |
| tree | c100b0b55cb2d80f276724ae3b33c351f1e64179 | |
| parent | f93e6ba1219711b0d5ee54e8b3841711eabac54f (diff) | |
Update tests for currentTransitionInfo
The current transtition info state is modified
under a flag. Update scene tests for it.
Test: atest SceneContainerStartableTest
Bug: 375630293
Flag: com.android.systemui.transition_race_condition
Change-Id: I01cfef9e1e1f295cdebd07ee150282a033675e15
| -rw-r--r-- | packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt index 385089122fc4..499592051731 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt @@ -651,6 +651,7 @@ class SceneContainerStartableTest : SysuiTestCase() { } @Test + @DisableFlags(Flags.FLAG_TRANSITION_RACE_CONDITION) fun switchToAOD_whenAvailable_whenDeviceSleepsLocked() = testScope.runTest { kosmos.lockscreenSceneTransitionInteractor.start() @@ -680,6 +681,7 @@ class SceneContainerStartableTest : SysuiTestCase() { } @Test + @DisableFlags(Flags.FLAG_TRANSITION_RACE_CONDITION) fun switchToDozing_whenAodUnavailable_whenDeviceSleepsLocked() = testScope.runTest { kosmos.lockscreenSceneTransitionInteractor.start() @@ -701,6 +703,56 @@ class SceneContainerStartableTest : SysuiTestCase() { } @Test + @EnableFlags(Flags.FLAG_TRANSITION_RACE_CONDITION) + fun switchToAOD_whenAvailable_whenDeviceSleepsLocked_transitionFlagEnabled() = + testScope.runTest { + kosmos.lockscreenSceneTransitionInteractor.start() + val asleepState by collectLastValue(kosmos.keyguardInteractor.asleepKeyguardState) + val transitionState = + prepareState(isDeviceUnlocked = false, initialSceneKey = Scenes.Shade) + kosmos.keyguardRepository.setAodAvailable(true) + runCurrent() + assertThat(asleepState).isEqualTo(KeyguardState.AOD) + underTest.start() + powerInteractor.setAsleepForTest() + runCurrent() + transitionState.value = + ObservableTransitionState.Transition( + fromScene = Scenes.Shade, + toScene = Scenes.Lockscreen, + currentScene = flowOf(Scenes.Lockscreen), + progress = flowOf(0.5f), + isInitiatedByUserInput = true, + isUserInputOngoing = flowOf(false), + ) + runCurrent() + + assertThat(kosmos.keyguardTransitionRepository.currentTransitionInfo.to) + .isEqualTo(KeyguardState.AOD) + } + + @Test + @EnableFlags(Flags.FLAG_TRANSITION_RACE_CONDITION) + fun switchToDozing_whenAodUnavailable_whenDeviceSleepsLocked_transitionFlagEnabled() = + testScope.runTest { + kosmos.lockscreenSceneTransitionInteractor.start() + val asleepState by collectLastValue(kosmos.keyguardInteractor.asleepKeyguardState) + val transitionState = + prepareState(isDeviceUnlocked = false, initialSceneKey = Scenes.Shade) + kosmos.keyguardRepository.setAodAvailable(false) + runCurrent() + assertThat(asleepState).isEqualTo(KeyguardState.DOZING) + underTest.start() + powerInteractor.setAsleepForTest() + runCurrent() + transitionState.value = Transition(from = Scenes.Shade, to = Scenes.Lockscreen) + runCurrent() + + assertThat(kosmos.keyguardTransitionRepository.currentTransitionInfo.to) + .isEqualTo(KeyguardState.DOZING) + } + + @Test fun switchToGoneWhenDoubleTapPowerGestureIsTriggeredFromGone() = testScope.runTest { val currentSceneKey by collectLastValue(sceneInteractor.currentScene) |