diff options
author | Nataniel Borges <natanieljr@google.com> | 2019-09-23 17:34:14 +0200 |
---|---|---|
committer | Nataniel Borges <natanieljr@google.com> | 2019-09-25 16:12:18 +0200 |
commit | d051c3b767b21b5b2490f0d05cc225430230e694 (patch) | |
tree | f342bac978a9c36f4cd698af05dafe3efeefb168 /tests/FlickerTests | |
parent | 4bfe8160307abf61e47b12c008d2d76357173076 (diff) |
New FlickerTests: Start app warm and cold at both 0 and 90 degrees
Test: atest OpenAppColdTest OpenAppWarmTest
Change-Id: I1ea7377a07938b583c537b3db2da7bd5a3fc0ae1
Diffstat (limited to 'tests/FlickerTests')
4 files changed, 50 insertions, 98 deletions
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java index a59bfa4984d4..9ff54bd5854b 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java @@ -74,13 +74,16 @@ class CommonTransitions { } static TransitionBuilder openAppWarm(IAppHelper testApp, UiDevice - device) { + device, int beginRotation) { return TransitionRunner.newBuilder() - .withTag("OpenAppWarm_" + testApp.getLauncherName()) + .withTag("OpenAppWarm_" + testApp.getLauncherName() + + rotationToString(beginRotation)) .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) + .runBeforeAll(() -> setRotation(device, beginRotation)) .runBeforeAll(testApp::open) .runBefore(device::pressHome) .runBefore(device::waitForIdle) + .runBefore(() -> setRotation(device, beginRotation)) .run(testApp::open) .runAfterAll(testApp::exit) .runAfterAll(AutomationUtils::setDefaultWait) @@ -115,16 +118,19 @@ class CommonTransitions { .repeat(ITERATIONS); } - static TransitionBuilder getOpenAppCold(IAppHelper testApp, - UiDevice device) { + static TransitionBuilder openAppCold(IAppHelper testApp, + UiDevice device, int beginRotation) { return TransitionRunner.newBuilder() - .withTag("OpenAppCold_" + testApp.getLauncherName()) + .withTag("OpenAppCold_" + testApp.getLauncherName() + + rotationToString(beginRotation)) .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) .runBefore(device::pressHome) + .runBeforeAll(() -> setRotation(device, beginRotation)) .runBefore(testApp::exit) .runBefore(device::waitForIdle) .run(testApp::open) .runAfterAll(testApp::exit) + .runAfterAll(() -> setRotation(device, Surface.ROTATION_0)) .repeat(ITERATIONS); } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java index ff0c49e3bdba..4e38113fb275 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java @@ -47,23 +47,25 @@ public class DebugTest { private UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); /** - * atest FlickerTest:DebugTests#openAppCold + * atest FlickerTests:DebugTest#openAppCold */ @Test public void openAppCold() { - CommonTransitions.getOpenAppCold(testApp, uiDevice).recordAllRuns().build().run(); + CommonTransitions.openAppCold(testApp, uiDevice, Surface.ROTATION_0) + .recordAllRuns().build().run(); } /** - * atest FlickerTest:DebugTests#openAppWarm + * atest FlickerTests:DebugTest#openAppWarm */ @Test public void openAppWarm() { - CommonTransitions.openAppWarm(testApp, uiDevice).recordAllRuns().build().run(); + CommonTransitions.openAppWarm(testApp, uiDevice, Surface.ROTATION_0) + .recordAllRuns().build().run(); } /** - * atest FlickerTest:DebugTests#changeOrientationFromNaturalToLeft + * atest FlickerTests:DebugTest#changeOrientationFromNaturalToLeft */ @Test public void changeOrientationFromNaturalToLeft() { @@ -72,7 +74,7 @@ public class DebugTest { } /** - * atest FlickerTest:DebugTests#closeAppWithBackKey + * atest FlickerTests:DebugTest#closeAppWithBackKey */ @Test public void closeAppWithBackKey() { @@ -80,7 +82,7 @@ public class DebugTest { } /** - * atest FlickerTest:DebugTests#closeAppWithHomeKey + * atest FlickerTests:DebugTest#closeAppWithHomeKey */ @Test public void closeAppWithHomeKey() { @@ -88,7 +90,7 @@ public class DebugTest { } /** - * atest FlickerTest:DebugTests#openAppToSplitScreen + * atest FlickerTests:DebugTest#openAppToSplitScreen */ @Test public void openAppToSplitScreen() { @@ -97,7 +99,7 @@ public class DebugTest { } /** - * atest FlickerTest:DebugTests#splitScreenToLauncher + * atest FlickerTests:DebugTest#splitScreenToLauncher */ @Test public void splitScreenToLauncher() { @@ -107,7 +109,7 @@ public class DebugTest { } /** - * atest FlickerTest:DebugTests#resizeSplitScreen + * atest FlickerTests:DebugTest#resizeSplitScreen */ @Test public void resizeSplitScreen() { @@ -120,7 +122,7 @@ public class DebugTest { // IME tests /** - * atest FlickerTest:DebugTests#editTextSetFocus + * atest FlickerTests:DebugTest#editTextSetFocus */ @Test public void editTextSetFocus() { @@ -131,7 +133,7 @@ public class DebugTest { } /** - * atest FlickerTest:DebugTests#editTextLoseFocusToHome + * atest FlickerTests:DebugTest#editTextLoseFocusToHome */ @Test public void editTextLoseFocusToHome() { @@ -142,7 +144,7 @@ public class DebugTest { } /** - * atest FlickerTest:DebugTests#editTextLoseFocusToApp + * atest FlickerTests:DebugTest#editTextLoseFocusToApp */ @Test public void editTextLoseFocusToApp() { @@ -155,7 +157,7 @@ public class DebugTest { // PIP tests /** - * atest FlickerTest:DebugTests#enterPipMode + * atest FlickerTests:DebugTest#enterPipMode */ @Test public void enterPipMode() { @@ -165,7 +167,7 @@ public class DebugTest { } /** - * atest FlickerTest:DebugTests#exitPipModeToHome + * atest FlickerTests:DebugTest#exitPipModeToHome */ @Test public void exitPipModeToHome() { @@ -175,7 +177,7 @@ public class DebugTest { } /** - * atest FlickerTest:DebugTests#exitPipModeToApp + * atest FlickerTests:DebugTest#exitPipModeToApp */ @Test public void exitPipModeToApp() { diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java index 8d99054d907e..efdfaee60e64 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java @@ -16,14 +16,12 @@ package com.android.server.wm.flicker; -import static com.android.server.wm.flicker.CommonTransitions.getOpenAppCold; -import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds; +import static com.android.server.wm.flicker.CommonTransitions.openAppCold; import static com.android.server.wm.flicker.WmTraceSubject.assertThat; import androidx.test.InstrumentationRegistry; import androidx.test.filters.FlakyTest; import androidx.test.filters.LargeTest; -import androidx.test.runner.AndroidJUnit4; import org.junit.Before; import org.junit.FixMethodOrder; @@ -31,36 +29,28 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; +import org.junit.runners.Parameterized; /** * Test cold launch app from launcher. * To run this test: {@code atest FlickerTests:OpenAppColdTest} */ @LargeTest -@RunWith(AndroidJUnit4.class) +@RunWith(Parameterized.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class OpenAppColdTest extends FlickerTestBase { +public class OpenAppColdTest extends NonRotationTestBase { + + public OpenAppColdTest(String beginRotationName, int beginRotation) { + super(beginRotationName, beginRotation); - public OpenAppColdTest() { this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); } @Before public void runTransition() { - super.runTransition(getOpenAppCold(mTestApp, mUiDevice).build()); - } - - @Test - public void checkVisibility_navBarWindowIsAlwaysVisible() { - checkResults(result -> assertThat(result) - .showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries()); - } - - @Test - public void checkVisibility_statusBarWindowIsAlwaysVisible() { - checkResults(result -> assertThat(result) - .showsAboveAppWindow(STATUS_BAR_WINDOW_TITLE).forAllEntries()); + run(openAppCold(mTestApp, mUiDevice, mBeginRotation) + .includeJankyRuns().build()); } @Test @@ -72,6 +62,8 @@ public class OpenAppColdTest extends FlickerTestBase { .forAllEntries()); } + @FlakyTest(bugId = 140855415) + @Ignore("Waiting bug feedback") @Test public void checkZOrder_appWindowReplacesLauncherAsTopWindow() { checkResults(result -> assertThat(result) @@ -83,26 +75,6 @@ public class OpenAppColdTest extends FlickerTestBase { } @Test - @FlakyTest(bugId = 141235985) - @Ignore("Waiting bug feedback") - public void checkCoveredRegion_noUncoveredRegions() { - checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion( - getDisplayBounds()).forAllEntries()); - } - - @Test - public void checkVisibility_navBarLayerIsAlwaysVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries()); - } - - @Test - public void checkVisibility_statusBarLayerIsAlwaysVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(STATUS_BAR_WINDOW_TITLE).forAllEntries()); - } - - @Test public void checkVisibility_wallpaperLayerBecomesInvisible() { checkResults(result -> LayersTraceSubject.assertThat(result) .showsLayer("Wallpaper") diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java index e8702c2dfa9f..7ce6315f529a 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java @@ -17,13 +17,11 @@ package com.android.server.wm.flicker; import static com.android.server.wm.flicker.CommonTransitions.openAppWarm; -import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds; import static com.android.server.wm.flicker.WmTraceSubject.assertThat; import androidx.test.InstrumentationRegistry; import androidx.test.filters.FlakyTest; import androidx.test.filters.LargeTest; -import androidx.test.runner.AndroidJUnit4; import org.junit.Before; import org.junit.FixMethodOrder; @@ -31,36 +29,28 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; +import org.junit.runners.Parameterized; /** * Test warm launch app. * To run this test: {@code atest FlickerTests:OpenAppWarmTest} */ @LargeTest -@RunWith(AndroidJUnit4.class) +@RunWith(Parameterized.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class OpenAppWarmTest extends FlickerTestBase { +public class OpenAppWarmTest extends NonRotationTestBase { + + public OpenAppWarmTest(String beginRotationName, int beginRotation) { + super(beginRotationName, beginRotation); - public OpenAppWarmTest() { this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); } @Before public void runTransition() { - super.runTransition(openAppWarm(mTestApp, mUiDevice).includeJankyRuns().build()); - } - - @Test - public void checkVisibility_navBarIsAlwaysVisible() { - checkResults(result -> assertThat(result) - .showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries()); - } - - @Test - public void checkVisibility_statusBarIsAlwaysVisible() { - checkResults(result -> assertThat(result) - .showsAboveAppWindow(STATUS_BAR_WINDOW_TITLE).forAllEntries()); + super.runTransition(openAppWarm(mTestApp, mUiDevice, mBeginRotation) + .includeJankyRuns().build()); } @Test @@ -72,6 +62,8 @@ public class OpenAppWarmTest extends FlickerTestBase { .forAllEntries()); } + @FlakyTest(bugId = 140855415) + @Ignore("Waiting bug feedback") @Test public void checkZOrder_appWindowReplacesLauncherAsTopWindow() { checkResults(result -> assertThat(result) @@ -82,26 +74,6 @@ public class OpenAppWarmTest extends FlickerTestBase { .forAllEntries()); } - @FlakyTest(bugId = 141235985) - @Ignore("Waiting bug feedback") - @Test - public void checkCoveredRegion_noUncoveredRegions() { - checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion( - getDisplayBounds()).forAllEntries()); - } - - @Test - public void checkVisibility_navBarLayerIsAlwaysVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries()); - } - - @Test - public void checkVisibility_statusBarLayerIsAlwaysVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(STATUS_BAR_WINDOW_TITLE).forAllEntries()); - } - @Test public void checkVisibility_wallpaperLayerBecomesInvisible() { checkResults(result -> LayersTraceSubject.assertThat(result) |