diff options
author | Nataniel Borges <natanieljr@google.com> | 2019-09-23 17:34:14 +0200 |
---|---|---|
committer | Nataniel Borges <natanieljr@google.com> | 2019-09-26 17:46:47 +0200 |
commit | 40c517afacb6841d200c67b5dd3fdb97f53101c8 (patch) | |
tree | 7524ada97ae80c692019f8ec178f5df264e9ff7d /tests/FlickerTests | |
parent | d051c3b767b21b5b2490f0d05cc225430230e694 (diff) |
New FlickerTests: Run split screen tests at 0 and 90 degrees
Test: atest ResizeSplitScreenTest
Change-Id: I44b0733f8abbb022f2a00072bbb398e6d29699c7
Diffstat (limited to 'tests/FlickerTests')
3 files changed, 32 insertions, 38 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 9ff54bd5854b..fd31aa531107 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java @@ -209,15 +209,17 @@ class CommonTransitions { .repeat(ITERATIONS); } - static TransitionBuilder resizeSplitScreen(IAppHelper testAppTop, IAppHelper testAppBottom, - UiDevice device, Rational startRatio, Rational stopRatio) { + static TransitionBuilder resizeSplitScreen(IAppHelper testAppTop, ImeAppHelper testAppBottom, + UiDevice device, int beginRotation, Rational startRatio, Rational stopRatio) { String testTag = "resizeSplitScreen_" + testAppTop.getLauncherName() + "_" + testAppBottom.getLauncherName() + "_" + startRatio.toString().replace("/", ":") + "_to_" - + stopRatio.toString().replace("/", ":"); + + stopRatio.toString().replace("/", ":") + "_" + + rotationToString(beginRotation); return TransitionRunner.newBuilder() .withTag(testTag) .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) + .runBeforeAll(() -> setRotation(device, beginRotation)) .runBeforeAll(() -> clearRecents(device)) .runBefore(testAppBottom::open) .runBefore(device::pressHome) @@ -229,6 +231,7 @@ class CommonTransitions { By.res(device.getLauncherPackageName(), "snapshot")); snapshot.click(); }) + .runBefore(() -> testAppBottom.clickEditTextWidget(device)) .runBefore(() -> AutomationUtils.resizeSplitScreen(device, startRatio)) .run(() -> AutomationUtils.resizeSplitScreen(device, stopRatio)) .runAfter(() -> exitSplitScreen(device)) 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 4e38113fb275..8f0177c7afc5 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java @@ -113,10 +113,10 @@ public class DebugTest { */ @Test public void resizeSplitScreen() { - IAppHelper bottomApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), - "com.android.server.wm.flicker.testapp", "ImeApp"); - CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, new Rational(1, 3), - new Rational(2, 3)).includeJankyRuns().recordEachRun().build().run(); + ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation()); + CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, Surface.ROTATION_0, + new Rational(1, 3), new Rational(2, 3)) + .includeJankyRuns().recordEachRun().build().run(); } // IME tests diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java index 1031baf7ec04..29b624005495 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java @@ -24,13 +24,13 @@ import static com.android.server.wm.flicker.WindowUtils.getNavigationBarHeight; import static com.google.common.truth.Truth.assertThat; import android.graphics.Rect; -import android.platform.helpers.IAppHelper; import android.util.Rational; import androidx.test.InstrumentationRegistry; import androidx.test.filters.FlakyTest; import androidx.test.filters.LargeTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.server.wm.flicker.helpers.ImeAppHelper; import org.junit.Before; import org.junit.FixMethodOrder; @@ -38,57 +38,48 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; +import org.junit.runners.Parameterized; /** * Test split screen resizing window transitions. * To run this test: {@code atest FlickerTests:ResizeSplitScreenTest} */ @LargeTest -@RunWith(AndroidJUnit4.class) +@RunWith(Parameterized.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -@FlakyTest(bugId = 140856143) +@FlakyTest(bugId = 140854698) @Ignore("Waiting bug feedback") -public class ResizeSplitScreenTest extends FlickerTestBase { +public class ResizeSplitScreenTest extends NonRotationTestBase { + + private static String sSimpleActivity = "SimpleActivity"; + private static String sImeActivity = "ImeActivity"; + + public ResizeSplitScreenTest(String beginRotationName, int beginRotation) { + super(beginRotationName, beginRotation); - public ResizeSplitScreenTest() { this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); } @Before public void runTransition() { - IAppHelper bottomApp = new StandardAppHelper(InstrumentationRegistry - .getInstrumentation(), - "com.android.server.wm.flicker.testapp", "ImeApp"); - super.runTransition(resizeSplitScreen(mTestApp, bottomApp, mUiDevice, new Rational(1, 3), - new Rational(2, 3)).includeJankyRuns().build()); - } - - @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()); + ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation()); + run(resizeSplitScreen(mTestApp, bottomApp, mUiDevice, mBeginRotation, + new Rational(1, 3), new Rational(2, 3)) + .includeJankyRuns().build()); } @Test public void checkVisibility_topAppLayerIsAlwaysVisible() { checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer("SimpleActivity") + .showsLayer(sSimpleActivity) .forAllEntries()); } @Test public void checkVisibility_bottomAppLayerIsAlwaysVisible() { checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer("ImeActivity") + .showsLayer(sImeActivity) .forAllEntries()); } @@ -149,11 +140,11 @@ public class ResizeSplitScreenTest extends FlickerTestBase { displayBounds.bottom - getNavigationBarHeight()); LayersTraceSubject.assertThat(result) - .hasVisibleRegion("SimpleActivity", startingTopAppBounds) + .hasVisibleRegion(sSimpleActivity, startingTopAppBounds) .atTheEnd(); LayersTraceSubject.assertThat(result) - .hasVisibleRegion("ImeActivity", startingBottomAppBounds) + .hasVisibleRegion(sImeActivity, startingBottomAppBounds) .atTheEnd(); }); } @@ -175,14 +166,14 @@ public class ResizeSplitScreenTest extends FlickerTestBase { @Test public void checkVisibility_topAppWindowIsAlwaysVisible() { checkResults(result -> WmTraceSubject.assertThat(result) - .showsAppWindow("SimpleActivity") + .showsAppWindow(sSimpleActivity) .forAllEntries()); } @Test public void checkVisibility_bottomAppWindowIsAlwaysVisible() { checkResults(result -> WmTraceSubject.assertThat(result) - .showsAppWindow("ImeActivity") + .showsAppWindow(sImeActivity) .forAllEntries()); } |