diff options
author | Nataniel Borges <natanieljr@google.com> | 2019-09-09 17:29:23 +0200 |
---|---|---|
committer | Nataniel Borges <natanieljr@google.com> | 2019-09-18 12:45:46 +0200 |
commit | f5c828cb48c2b01828a967e1af64faa34daf8fc7 (patch) | |
tree | ccbc569a7a72895bbf030ce0a4f384c8a6aea836 /tests/FlickerTests/src | |
parent | 0d4ac4ec1cbc767d8613f79592b51d978ca83846 (diff) |
Make Flicker Tests compatible with current AOSP
Current status:
atest FlickerTests: Passed: 132, Failed: 11, Ignored: 0
Test: atest FlickerTests
Change-Id: I581005fd293631630a3939eeaae485c1fd41ebb9
Diffstat (limited to 'tests/FlickerTests/src')
14 files changed, 98 insertions, 113 deletions
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java index b6860cbd8d96..ea85f365854b 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java @@ -32,8 +32,10 @@ import androidx.test.InstrumentationRegistry; import androidx.test.filters.LargeTest; 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; import org.junit.runners.Parameterized.Parameters; @@ -44,18 +46,19 @@ import java.util.Collection; * Cycle through supported app rotations. * To run this test: {@code atest FlickerTest:ChangeAppRotationTest} */ -@RunWith(Parameterized.class) @LargeTest +@RunWith(Parameterized.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class ChangeAppRotationTest extends FlickerTestBase { - private int beginRotation; - private int endRotation; + private int mBeginRotation; + private int mEndRotation; public ChangeAppRotationTest(String beginRotationName, String endRotationName, int beginRotation, int endRotation) { - this.testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), + this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); - this.beginRotation = beginRotation; - this.endRotation = endRotation; + this.mBeginRotation = beginRotation; + this.mEndRotation = endRotation; } @Parameters(name = "{0}-{1}") @@ -77,7 +80,7 @@ public class ChangeAppRotationTest extends FlickerTestBase { @Before public void runTransition() { super.runTransition( - changeAppRotation(testApp, uiDevice, beginRotation, endRotation).build()); + changeAppRotation(mTestApp, mUiDevice, mBeginRotation, mEndRotation).build()); } @Test @@ -94,8 +97,8 @@ public class ChangeAppRotationTest extends FlickerTestBase { @Test public void checkPosition_navBarLayerRotatesAndScales() { - Rect startingPos = getNavigationBarPosition(beginRotation); - Rect endingPos = getNavigationBarPosition(endRotation); + Rect startingPos = getNavigationBarPosition(mBeginRotation); + Rect endingPos = getNavigationBarPosition(mEndRotation); checkResults(result -> { LayersTraceSubject.assertThat(result) .hasVisibleRegion(NAVIGATION_BAR_WINDOW_TITLE, startingPos) @@ -108,22 +111,22 @@ public class ChangeAppRotationTest extends FlickerTestBase { @Test public void checkPosition_appLayerRotates() { - Rect startingPos = getAppPosition(beginRotation); - Rect endingPos = getAppPosition(endRotation); + Rect startingPos = getAppPosition(mBeginRotation); + Rect endingPos = getAppPosition(mEndRotation); Log.e(TAG, "startingPos=" + startingPos + " endingPos=" + endingPos); checkResults(result -> { LayersTraceSubject.assertThat(result) - .hasVisibleRegion(testApp.getPackage(), startingPos).inTheBeginning(); + .hasVisibleRegion(mTestApp.getPackage(), startingPos).inTheBeginning(); LayersTraceSubject.assertThat(result) - .hasVisibleRegion(testApp.getPackage(), endingPos).atTheEnd(); + .hasVisibleRegion(mTestApp.getPackage(), endingPos).atTheEnd(); } ); } @Test public void checkPosition_statusBarLayerScales() { - Rect startingPos = getStatusBarPosition(beginRotation); - Rect endingPos = getStatusBarPosition(endRotation); + Rect startingPos = getStatusBarPosition(mBeginRotation); + Rect endingPos = getStatusBarPosition(mEndRotation); checkResults(result -> { LayersTraceSubject.assertThat(result) .hasVisibleRegion(STATUS_BAR_WINDOW_TITLE, startingPos) diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java index 6590b86f1499..9deb97726542 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java @@ -26,8 +26,10 @@ 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; /** * Test IME window closing back to app window transitions. @@ -35,6 +37,7 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class CloseImeWindowToAppTest extends FlickerTestBase { private static final String IME_WINDOW_TITLE = "InputMethod"; @@ -44,7 +47,7 @@ public class CloseImeWindowToAppTest extends FlickerTestBase { @Before public void runTransition() { - super.runTransition(editTextLoseFocusToApp(uiDevice) + super.runTransition(editTextLoseFocusToApp(mUiDevice) .includeJankyRuns().build()); } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java index 4771b02000c0..cce5a2a7cc0d 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java @@ -26,8 +26,10 @@ 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; /** * Test IME window closing to home transitions. @@ -35,6 +37,7 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class CloseImeWindowToHomeTest extends FlickerTestBase { private static final String IME_WINDOW_TITLE = "InputMethod"; @@ -44,7 +47,7 @@ public class CloseImeWindowToHomeTest extends FlickerTestBase { @Before public void runTransition() { - super.runTransition(editTextLoseFocusToHome(uiDevice) + super.runTransition(editTextLoseFocusToHome(mUiDevice) .includeJankyRuns().build()); } 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 5cf2c1cd6827..0173b24bb528 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java @@ -216,10 +216,10 @@ class CommonTransitions { static TransitionBuilder resizeSplitScreen(IAppHelper testAppTop, IAppHelper testAppBottom, UiDevice device, Rational startRatio, Rational stopRatio) { - String testTag = "resizeSplitScreen_" + testAppTop.getLauncherName() + "_" + - testAppBottom.getLauncherName() + "_" + - startRatio.toString().replace("/", ":") + "_to_" + - stopRatio.toString().replace("/", ":"); + String testTag = "resizeSplitScreen_" + testAppTop.getLauncherName() + "_" + + testAppBottom.getLauncherName() + "_" + + startRatio.toString().replace("/", ":") + "_to_" + + stopRatio.toString().replace("/", ":"); return TransitionRunner.newBuilder() .withTag(testTag) .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) @@ -231,7 +231,7 @@ class CommonTransitions { .runBefore(() -> launchSplitScreen(device)) .runBefore(() -> { UiObject2 snapshot = device.findObject( - By.res("com.google.android.apps.nexuslauncher", "snapshot")); + By.res(device.getLauncherPackageName(), "snapshot")); snapshot.click(); }) .runBefore(() -> AutomationUtils.resizeSplitScreen(device, startRatio)) @@ -316,4 +316,4 @@ class CommonTransitions { .runAfterAll(testApp::exit) .repeat(ITERATIONS); } -}
\ No newline at end of file +} 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 61cca0d6b53f..9836655bc013 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java @@ -22,17 +22,22 @@ import android.util.Rational; import android.view.Surface; import androidx.test.InstrumentationRegistry; +import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; +import org.junit.FixMethodOrder; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; /** * Tests to help debug individual transitions, capture video recordings and create test cases. */ +@LargeTest @Ignore("Used for debugging transitions used in FlickerTests.") @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class DebugTest { private IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java b/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java index 8c9d6b4dc7a0..6e8e0c3c76c5 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java @@ -16,20 +16,23 @@ package com.android.server.wm.flicker; +import static androidx.test.InstrumentationRegistry.getInstrumentation; + import static com.android.server.wm.flicker.helpers.AutomationUtils.setDefaultWait; import static com.google.common.truth.Truth.assertWithMessage; +import android.os.Bundle; import android.platform.helpers.IAppHelper; +import android.support.test.InstrumentationRegistry; import android.support.test.uiautomator.UiDevice; import android.util.Log; -import androidx.test.InstrumentationRegistry; - import com.android.server.wm.flicker.TransitionRunner.TransitionResult; import org.junit.After; import org.junit.AfterClass; +import org.junit.Before; import java.util.HashMap; import java.util.List; @@ -51,10 +54,16 @@ public class FlickerTestBase { static final String DOCKED_STACK_DIVIDER = "DockedStackDivider"; private static HashMap<String, List<TransitionResult>> transitionResults = new HashMap<>(); - IAppHelper testApp; - UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); - private List<TransitionResult> results; - private TransitionResult lastResult = null; + IAppHelper mTestApp; + UiDevice mUiDevice; + private List<TransitionResult> mResults; + private TransitionResult mLastResult = null; + + @Before + public void setUp() { + InstrumentationRegistry.registerInstance(getInstrumentation(), new Bundle()); + mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); + } /** * Teardown any system settings and clean up test artifacts from the file system. @@ -91,14 +100,14 @@ public class FlickerTestBase { */ void runTransition(TransitionRunner transition) { if (transitionResults.containsKey(transition.getTestTag())) { - results = transitionResults.get(transition.getTestTag()); + mResults = transitionResults.get(transition.getTestTag()); return; } - results = transition.run().getResults(); + mResults = transition.run().getResults(); /* Fail if we don't have any results due to jank */ assertWithMessage("No results to test because all transition runs were invalid because " - + "of Jank").that(results).isNotEmpty(); - transitionResults.put(transition.getTestTag(), results); + + "of Jank").that(mResults).isNotEmpty(); + transitionResults.put(transition.getTestTag(), mResults); } /** @@ -106,11 +115,11 @@ public class FlickerTestBase { */ void checkResults(Consumer<TransitionResult> assertion) { - for (TransitionResult result : results) { - lastResult = result; + for (TransitionResult result : mResults) { + mLastResult = result; assertion.accept(result); } - lastResult = null; + mLastResult = null; } /** @@ -119,8 +128,8 @@ public class FlickerTestBase { */ @After public void markArtifactsForSaving() { - if (lastResult != null) { - lastResult.flagForSaving(); + if (mLastResult != null) { + mLastResult.flagForSaving(); } } } 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 7818c4e4ba50..f3180b90e628 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java @@ -25,8 +25,10 @@ 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; /** * Test cold launch app from launcher. @@ -34,16 +36,17 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class OpenAppColdTest extends FlickerTestBase { public OpenAppColdTest() { - this.testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), + this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); } @Before public void runTransition() { - super.runTransition(getOpenAppCold(testApp, uiDevice).build()); + super.runTransition(getOpenAppCold(mTestApp, mUiDevice).build()); } @Test @@ -73,7 +76,7 @@ public class OpenAppColdTest extends FlickerTestBase { .showsAppWindowOnTop( "com.google.android.apps.nexuslauncher/.NexusLauncherActivity") .then() - .showsAppWindowOnTop(testApp.getPackage()) + .showsAppWindowOnTop(mTestApp.getPackage()) .forAllEntries()); } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java index 63018ec1d9e7..f8b7938901a8 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java @@ -24,8 +24,10 @@ 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; /** * Test open app to split screen. @@ -33,16 +35,17 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class OpenAppToSplitScreenTest extends FlickerTestBase { public OpenAppToSplitScreenTest() { - this.testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), + this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); } @Before public void runTransition() { - super.runTransition(appToSplitScreen(testApp, uiDevice).includeJankyRuns().build()); + super.runTransition(appToSplitScreen(mTestApp, mUiDevice).includeJankyRuns().build()); } @Test 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 1aba93056c89..a57c514a2fc6 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java @@ -25,8 +25,10 @@ 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; /** * Test warm launch app. @@ -34,16 +36,17 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class OpenAppWarmTest extends FlickerTestBase { public OpenAppWarmTest() { - this.testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), + this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); } @Before public void runTransition() { - super.runTransition(openAppWarm(testApp, uiDevice).build()); + super.runTransition(openAppWarm(mTestApp, mUiDevice).build()); } @Test @@ -73,7 +76,7 @@ public class OpenAppWarmTest extends FlickerTestBase { .showsAppWindowOnTop( "com.google.android.apps.nexuslauncher/.NexusLauncherActivity") .then() - .showsAppWindowOnTop(testApp.getPackage()) + .showsAppWindowOnTop(mTestApp.getPackage()) .forAllEntries()); } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java index a81fa8e6d123..9f5cfcedd38f 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java @@ -23,8 +23,10 @@ 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; /** * Test IME window opening transitions. @@ -32,13 +34,14 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class OpenImeWindowTest extends FlickerTestBase { private static final String IME_WINDOW_TITLE = "InputMethod"; @Before public void runTransition() { - super.runTransition(editTextSetFocus(uiDevice) + super.runTransition(editTextSetFocus(mUiDevice) .includeJankyRuns().build()); } 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 50dba81e53b7..abb1373fb859 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java @@ -32,8 +32,10 @@ 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; /** * Test split screen resizing window transitions. @@ -41,10 +43,11 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class ResizeSplitScreenTest extends FlickerTestBase { public ResizeSplitScreenTest() { - this.testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), + this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); } @@ -53,7 +56,7 @@ public class ResizeSplitScreenTest extends FlickerTestBase { IAppHelper bottomApp = new StandardAppHelper(InstrumentationRegistry .getInstrumentation(), "com.android.server.wm.flicker.testapp", "ImeApp"); - super.runTransition(resizeSplitScreen(testApp, bottomApp, uiDevice, new Rational(1, 3), + super.runTransition(resizeSplitScreen(mTestApp, bottomApp, mUiDevice, new Rational(1, 3), new Rational(2, 3)).includeJankyRuns().build()); } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java index 117ac5a8fadf..ae55a75d7e67 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java @@ -33,8 +33,10 @@ import androidx.test.InstrumentationRegistry; import androidx.test.filters.LargeTest; 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; import org.junit.runners.Parameterized.Parameters; @@ -47,6 +49,7 @@ import java.util.Collection; */ @LargeTest @RunWith(Parameterized.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class SeamlessAppRotationTest extends FlickerTestBase { private int mBeginRotation; private int mEndRotation; @@ -105,7 +108,7 @@ public class SeamlessAppRotationTest extends FlickerTestBase { super.runTransition( changeAppRotation(mIntent, intentId, InstrumentationRegistry.getContext(), - uiDevice, mBeginRotation, mEndRotation).repeat(5).build()); + mUiDevice, mBeginRotation, mEndRotation).repeat(5).build()); } @Test diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java index 1d30df9750b2..c639843a5e8c 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java @@ -25,8 +25,10 @@ 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; /** * Test open app to split screen. @@ -34,16 +36,17 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class SplitScreenToLauncherTest extends FlickerTestBase { public SplitScreenToLauncherTest() { - this.testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), + this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); } @Before public void runTransition() { - super.runTransition(splitScreenToLauncher(testApp, uiDevice).includeJankyRuns().build()); + super.runTransition(splitScreenToLauncher(mTestApp, mUiDevice).includeJankyRuns().build()); } @Test @@ -66,9 +69,9 @@ public class SplitScreenToLauncherTest extends FlickerTestBase { @Test public void checkVisibility_appLayerBecomesInVisible() { checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(testApp.getPackage()) + .showsLayer(mTestApp.getPackage()) .then() - .hidesLayer(testApp.getPackage()) + .hidesLayer(mTestApp.getPackage()) .forAllEntries()); } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/StandardAppHelper.java b/tests/FlickerTests/src/com/android/server/wm/flicker/StandardAppHelper.java deleted file mode 100644 index 79a0220e0e87..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/StandardAppHelper.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.server.wm.flicker; - -import android.app.Instrumentation; -import android.platform.helpers.AbstractStandardAppHelper; - -/** - * Class to take advantage of {@code IAppHelper} interface so the same test can be run against - * first party and third party apps. - */ -public class StandardAppHelper extends AbstractStandardAppHelper { - private final String mPackageName; - private final String mLauncherName; - - public StandardAppHelper(Instrumentation instr, String packageName, String launcherName) { - super(instr); - mPackageName = packageName; - mLauncherName = launcherName; - } - - /** - * {@inheritDoc} - */ - @Override - public String getPackage() { - return mPackageName; - } - - /** - * {@inheritDoc} - */ - @Override - public String getLauncherName() { - return mLauncherName; - } - - /** - * {@inheritDoc} - */ - @Override - public void dismissInitialDialogs() { - - } -} |