Loading tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java +15 −19 Original line number Diff line number Diff line Loading @@ -17,37 +17,39 @@ package com.android.server.wm.flicker; import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusToApp; import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds; import android.platform.helpers.IAppHelper; import androidx.test.InstrumentationRegistry; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Before; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; import org.junit.runners.Parameterized; /** * Test IME window closing back to app window transitions. * To run this test: {@code atest FlickerTests:CloseImeWindowToAppTest} */ @LargeTest @RunWith(AndroidJUnit4.class) @RunWith(Parameterized.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class CloseImeWindowToAppTest extends FlickerTestBase { public class CloseImeWindowToAppTest extends NonRotationTestBase { static final String IME_WINDOW_TITLE = "InputMethod"; private static final String IME_WINDOW_TITLE = "InputMethod"; private IAppHelper mImeTestApp = new StandardAppHelper( public CloseImeWindowToAppTest(String beginRotationName, int beginRotation) { super(beginRotationName, beginRotation); mTestApp = new StandardAppHelper( InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "ImeApp"); } @Before public void runTransition() { super.runTransition(editTextLoseFocusToApp(mUiDevice) run(editTextLoseFocusToApp(mTestApp, mUiDevice, mBeginRotation, /* clickOnEditField */true) .includeJankyRuns().build()); } Loading @@ -63,20 +65,14 @@ public class CloseImeWindowToAppTest extends FlickerTestBase { @Test public void checkVisibility_imeAppLayerIsAlwaysVisible() { checkResults(result -> LayersTraceSubject.assertThat(result) .showsLayer(mImeTestApp.getPackage()) .showsLayer(mTestApp.getPackage()) .forAllEntries()); } @Test public void checkVisibility_imeAppWindowIsAlwaysVisible() { checkResults(result -> WmTraceSubject.assertThat(result) .showsAppWindowOnTop(mImeTestApp.getPackage()) .showsAppWindowOnTop(mTestApp.getPackage()) .forAllEntries()); } @Test public void checkCoveredRegion_noUncoveredRegions() { checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion( getDisplayBounds()).forAllEntries()); } } tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java +18 −21 Original line number Diff line number Diff line Loading @@ -17,37 +17,40 @@ package com.android.server.wm.flicker; import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusToHome; import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds; import android.platform.helpers.IAppHelper; import androidx.test.InstrumentationRegistry; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Before; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; import org.junit.runners.Parameterized; /** * Test IME window closing to home transitions. * To run this test: {@code atest FlickerTests:CloseImeWindowToHomeTest} */ @LargeTest @RunWith(AndroidJUnit4.class) @RunWith(Parameterized.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class CloseImeWindowToHomeTest extends FlickerTestBase { public class CloseImeWindowToHomeTest extends NonRotationTestBase { static final String IME_WINDOW_TITLE = "InputMethod"; private static final String IME_WINDOW_TITLE = "InputMethod"; private IAppHelper mImeTestApp = new StandardAppHelper( public CloseImeWindowToHomeTest(String beginRotationName, int beginRotation) { super(beginRotationName, beginRotation); mTestApp = new StandardAppHelper( InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "ImeApp"); } @Before public void runTransition() { super.runTransition(editTextLoseFocusToHome(mUiDevice) run(editTextLoseFocusToHome(mTestApp, mUiDevice, mBeginRotation, /* clickOnEditField */ true) .includeJankyRuns().build()); } Loading @@ -72,24 +75,18 @@ public class CloseImeWindowToHomeTest extends FlickerTestBase { @Test public void checkVisibility_imeAppLayerBecomesInvisible() { checkResults(result -> LayersTraceSubject.assertThat(result) .showsLayer(mImeTestApp.getPackage()) .showsLayer(mTestApp.getPackage()) .then() .hidesLayer(mImeTestApp.getPackage()) .hidesLayer(mTestApp.getPackage()) .forAllEntries()); } @Test public void checkVisibility_imeAppWindowBecomesInvisible() { checkResults(result -> WmTraceSubject.assertThat(result) .showsAppWindowOnTop(mImeTestApp.getPackage()) .showsAppWindowOnTop(mTestApp.getPackage()) .then() .hidesAppWindowOnTop(mImeTestApp.getPackage()) .hidesAppWindowOnTop(mTestApp.getPackage()) .forAllEntries()); } @Test public void checkCoveredRegion_noUncoveredRegions() { checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion( getDisplayBounds()).forAllEntries()); } } tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java +20 −10 Original line number Diff line number Diff line Loading @@ -243,30 +243,40 @@ class CommonTransitions { .repeat(ITERATIONS); } static TransitionBuilder editTextLoseFocusToHome(UiDevice device) { IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "ImeApp"); static TransitionBuilder editTextLoseFocusToHome(IAppHelper testApp, UiDevice device, int beginRotation, boolean clickOnEditText) { return TransitionRunner.newBuilder() .withTag("editTextLoseFocusToHome_" + testApp.getLauncherName()) .withTag("editTextLoseFocusToHome_" + testApp.getLauncherName() + rotationToString(beginRotation)) .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) .runBefore(device::pressHome) .runBefore(() -> setRotation(device, beginRotation)) .runBefore(testApp::open) .runBefore(() -> clickEditTextWidget(device, testApp)) .runBefore(() -> { if (clickOnEditText) { clickEditTextWidget(device, testApp); } }) .run(device::pressHome) .run(device::waitForIdle) .runAfterAll(testApp::exit) .repeat(ITERATIONS); } static TransitionBuilder editTextLoseFocusToApp(UiDevice device) { IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "ImeApp"); static TransitionBuilder editTextLoseFocusToApp(IAppHelper testApp, UiDevice device, int beginRotation, boolean clickOnEditText) { return TransitionRunner.newBuilder() .withTag("editTextLoseFocusToApp_" + testApp.getLauncherName()) .withTag("editTextLoseFocusToApp_" + testApp.getLauncherName() + rotationToString(beginRotation)) .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) .runBefore(device::pressHome) .runBefore(() -> setRotation(device, beginRotation)) .runBefore(testApp::open) .runBefore(() -> clickEditTextWidget(device, testApp)) .runBefore(() -> { if (clickOnEditText) { clickEditTextWidget(device, testApp); } }) .run(device::pressBack) .run(device::waitForIdle) .runAfterAll(testApp::exit) Loading tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java +6 −2 Original line number Diff line number Diff line Loading @@ -130,7 +130,10 @@ public class DebugTest { */ @Test public void editTextLoseFocusToHome() { CommonTransitions.editTextLoseFocusToHome(uiDevice).includeJankyRuns().recordEachRun() IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "ImeApp"); CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0, /* clickOnEditField */true).includeJankyRuns().recordEachRun() .build().run(); } Loading @@ -139,7 +142,8 @@ public class DebugTest { */ @Test public void editTextLoseFocusToApp() { CommonTransitions.editTextLoseFocusToHome(uiDevice).includeJankyRuns().recordEachRun() CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0, /* clickOnEditField */true).includeJankyRuns().recordEachRun() .build().run(); } Loading tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java +8 −1 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ public class FlickerTestBase { /** * Runs a transition, returns a cached result if the transition has run before. */ void runTransition(TransitionRunner transition) { void run(TransitionRunner transition) { if (transitionResults.containsKey(transition.getTestTag())) { mResults = transitionResults.get(transition.getTestTag()); return; Loading @@ -110,6 +110,13 @@ public class FlickerTestBase { transitionResults.put(transition.getTestTag(), mResults); } /** * Runs a transition, returns a cached result if the transition has run before. */ void runTransition(TransitionRunner transition) { run(transition); } /** * Goes through a list of transition results and checks assertions on each result. */ Loading Loading
tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java +15 −19 Original line number Diff line number Diff line Loading @@ -17,37 +17,39 @@ package com.android.server.wm.flicker; import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusToApp; import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds; import android.platform.helpers.IAppHelper; import androidx.test.InstrumentationRegistry; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Before; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; import org.junit.runners.Parameterized; /** * Test IME window closing back to app window transitions. * To run this test: {@code atest FlickerTests:CloseImeWindowToAppTest} */ @LargeTest @RunWith(AndroidJUnit4.class) @RunWith(Parameterized.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class CloseImeWindowToAppTest extends FlickerTestBase { public class CloseImeWindowToAppTest extends NonRotationTestBase { static final String IME_WINDOW_TITLE = "InputMethod"; private static final String IME_WINDOW_TITLE = "InputMethod"; private IAppHelper mImeTestApp = new StandardAppHelper( public CloseImeWindowToAppTest(String beginRotationName, int beginRotation) { super(beginRotationName, beginRotation); mTestApp = new StandardAppHelper( InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "ImeApp"); } @Before public void runTransition() { super.runTransition(editTextLoseFocusToApp(mUiDevice) run(editTextLoseFocusToApp(mTestApp, mUiDevice, mBeginRotation, /* clickOnEditField */true) .includeJankyRuns().build()); } Loading @@ -63,20 +65,14 @@ public class CloseImeWindowToAppTest extends FlickerTestBase { @Test public void checkVisibility_imeAppLayerIsAlwaysVisible() { checkResults(result -> LayersTraceSubject.assertThat(result) .showsLayer(mImeTestApp.getPackage()) .showsLayer(mTestApp.getPackage()) .forAllEntries()); } @Test public void checkVisibility_imeAppWindowIsAlwaysVisible() { checkResults(result -> WmTraceSubject.assertThat(result) .showsAppWindowOnTop(mImeTestApp.getPackage()) .showsAppWindowOnTop(mTestApp.getPackage()) .forAllEntries()); } @Test public void checkCoveredRegion_noUncoveredRegions() { checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion( getDisplayBounds()).forAllEntries()); } }
tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java +18 −21 Original line number Diff line number Diff line Loading @@ -17,37 +17,40 @@ package com.android.server.wm.flicker; import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusToHome; import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds; import android.platform.helpers.IAppHelper; import androidx.test.InstrumentationRegistry; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Before; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; import org.junit.runners.Parameterized; /** * Test IME window closing to home transitions. * To run this test: {@code atest FlickerTests:CloseImeWindowToHomeTest} */ @LargeTest @RunWith(AndroidJUnit4.class) @RunWith(Parameterized.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class CloseImeWindowToHomeTest extends FlickerTestBase { public class CloseImeWindowToHomeTest extends NonRotationTestBase { static final String IME_WINDOW_TITLE = "InputMethod"; private static final String IME_WINDOW_TITLE = "InputMethod"; private IAppHelper mImeTestApp = new StandardAppHelper( public CloseImeWindowToHomeTest(String beginRotationName, int beginRotation) { super(beginRotationName, beginRotation); mTestApp = new StandardAppHelper( InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "ImeApp"); } @Before public void runTransition() { super.runTransition(editTextLoseFocusToHome(mUiDevice) run(editTextLoseFocusToHome(mTestApp, mUiDevice, mBeginRotation, /* clickOnEditField */ true) .includeJankyRuns().build()); } Loading @@ -72,24 +75,18 @@ public class CloseImeWindowToHomeTest extends FlickerTestBase { @Test public void checkVisibility_imeAppLayerBecomesInvisible() { checkResults(result -> LayersTraceSubject.assertThat(result) .showsLayer(mImeTestApp.getPackage()) .showsLayer(mTestApp.getPackage()) .then() .hidesLayer(mImeTestApp.getPackage()) .hidesLayer(mTestApp.getPackage()) .forAllEntries()); } @Test public void checkVisibility_imeAppWindowBecomesInvisible() { checkResults(result -> WmTraceSubject.assertThat(result) .showsAppWindowOnTop(mImeTestApp.getPackage()) .showsAppWindowOnTop(mTestApp.getPackage()) .then() .hidesAppWindowOnTop(mImeTestApp.getPackage()) .hidesAppWindowOnTop(mTestApp.getPackage()) .forAllEntries()); } @Test public void checkCoveredRegion_noUncoveredRegions() { checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion( getDisplayBounds()).forAllEntries()); } }
tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java +20 −10 Original line number Diff line number Diff line Loading @@ -243,30 +243,40 @@ class CommonTransitions { .repeat(ITERATIONS); } static TransitionBuilder editTextLoseFocusToHome(UiDevice device) { IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "ImeApp"); static TransitionBuilder editTextLoseFocusToHome(IAppHelper testApp, UiDevice device, int beginRotation, boolean clickOnEditText) { return TransitionRunner.newBuilder() .withTag("editTextLoseFocusToHome_" + testApp.getLauncherName()) .withTag("editTextLoseFocusToHome_" + testApp.getLauncherName() + rotationToString(beginRotation)) .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) .runBefore(device::pressHome) .runBefore(() -> setRotation(device, beginRotation)) .runBefore(testApp::open) .runBefore(() -> clickEditTextWidget(device, testApp)) .runBefore(() -> { if (clickOnEditText) { clickEditTextWidget(device, testApp); } }) .run(device::pressHome) .run(device::waitForIdle) .runAfterAll(testApp::exit) .repeat(ITERATIONS); } static TransitionBuilder editTextLoseFocusToApp(UiDevice device) { IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "ImeApp"); static TransitionBuilder editTextLoseFocusToApp(IAppHelper testApp, UiDevice device, int beginRotation, boolean clickOnEditText) { return TransitionRunner.newBuilder() .withTag("editTextLoseFocusToApp_" + testApp.getLauncherName()) .withTag("editTextLoseFocusToApp_" + testApp.getLauncherName() + rotationToString(beginRotation)) .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) .runBefore(device::pressHome) .runBefore(() -> setRotation(device, beginRotation)) .runBefore(testApp::open) .runBefore(() -> clickEditTextWidget(device, testApp)) .runBefore(() -> { if (clickOnEditText) { clickEditTextWidget(device, testApp); } }) .run(device::pressBack) .run(device::waitForIdle) .runAfterAll(testApp::exit) Loading
tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java +6 −2 Original line number Diff line number Diff line Loading @@ -130,7 +130,10 @@ public class DebugTest { */ @Test public void editTextLoseFocusToHome() { CommonTransitions.editTextLoseFocusToHome(uiDevice).includeJankyRuns().recordEachRun() IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "ImeApp"); CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0, /* clickOnEditField */true).includeJankyRuns().recordEachRun() .build().run(); } Loading @@ -139,7 +142,8 @@ public class DebugTest { */ @Test public void editTextLoseFocusToApp() { CommonTransitions.editTextLoseFocusToHome(uiDevice).includeJankyRuns().recordEachRun() CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0, /* clickOnEditField */true).includeJankyRuns().recordEachRun() .build().run(); } Loading
tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java +8 −1 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ public class FlickerTestBase { /** * Runs a transition, returns a cached result if the transition has run before. */ void runTransition(TransitionRunner transition) { void run(TransitionRunner transition) { if (transitionResults.containsKey(transition.getTestTag())) { mResults = transitionResults.get(transition.getTestTag()); return; Loading @@ -110,6 +110,13 @@ public class FlickerTestBase { transitionResults.put(transition.getTestTag(), mResults); } /** * Runs a transition, returns a cached result if the transition has run before. */ void runTransition(TransitionRunner transition) { run(transition); } /** * Goes through a list of transition results and checks assertions on each result. */ Loading