From 847211bc5205f5c6f0da868d25765b140d7b5ed6 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Mon, 29 Nov 2021 10:14:52 -0800 Subject: [PATCH] FlickerTests: Fix focus change test during rotation Windows maybe recreated when rotated. Checks that the focus does not change or if it does, focus returns to testApp. Bug: 190185577 Test: atest FlickerTests:com.android.server.wm.flicker.rotation.ChangeAppRotationTest Change-Id: I9a4335c15e865498a2fd506b6edeea5ae5714497 --- .../flicker/rotation/ChangeAppRotationTest.kt | 11 +++++++--- .../wm/flicker/rotation/RotationTransition.kt | 11 ---------- .../rotation/SeamlessAppRotationTest.kt | 22 +++++++++++-------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt index cac7978d8c44d..c18798f0a4b08 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt @@ -114,11 +114,16 @@ class ChangeAppRotationTest( flickerRule.checkFlakyAssertions() } - /** {@inheritDoc} */ + /** + * Windows maybe recreated when rotated. Checks that the focus does not change or if it does, + * focus returns to [testApp] + */ @FlakyTest(bugId = 190185577) @Test - override fun focusDoesNotChange() { - super.focusDoesNotChange() + fun focusChanges() { + testSpec.assertEventLog { + this.focusChanges(testApp.`package`) + } } /** diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/RotationTransition.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/RotationTransition.kt index ce2347d7c1f27..d1bdeed81b788 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/RotationTransition.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/RotationTransition.kt @@ -128,17 +128,6 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter) @Test open fun entireScreenCovered() = testSpec.entireScreenCovered() - /** - * Checks that the focus doesn't change during animation - */ - @Presubmit - @Test - open fun focusDoesNotChange() { - testSpec.assertEventLog { - this.focusDoesNotChange() - } - } - /** * Checks that [testApp] layer covers the entire screen at the start of the transition */ diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt index 3ca60e3233cd7..e44bee644ceb9 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt @@ -146,15 +146,6 @@ class SeamlessAppRotationTest( } } - /** {@inheritDoc} */ - @Presubmit - @Test - override fun focusDoesNotChange() { - // This test doesn't work in shell transitions because of b/206101151 - assumeFalse(isShellTransitionsEnabled) - super.focusDoesNotChange() - } - /** * Checks that [testApp] layer covers the entire screen during the whole transition */ @@ -196,6 +187,19 @@ class SeamlessAppRotationTest( } } + /** + * Checks that the focus doesn't change during animation + */ + @Presubmit + @Test + fun focusDoesNotChange() { + // This test doesn't work in shell transitions because of b/206101151 + assumeFalse(isShellTransitionsEnabled) + testSpec.assertEventLog { + this.focusDoesNotChange() + } + } + /** {@inheritDoc} */ @FlakyTest @Test