diff options
author | Tony Wickham <twickham@google.com> | 2019-10-16 14:31:29 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2019-10-23 23:40:57 +0000 |
commit | 476b7d4378937d0128edf60779cfbdb77aa799ed (patch) | |
tree | c462f539d65f5f9118651fcfc5022b562d9d7ad2 /quickstep | |
parent | a0f77c4449753490adca6863cbf97c509e70e17a (diff) | |
download | packages_apps_Trebuchet-476b7d4378937d0128edf60779cfbdb77aa799ed.tar.gz packages_apps_Trebuchet-476b7d4378937d0128edf60779cfbdb77aa799ed.tar.bz2 packages_apps_Trebuchet-476b7d4378937d0128edf60779cfbdb77aa799ed.zip |
Fix testQuickSwitchFromApp
Instead of starting getAppPackageName() and relying on it being our Test
Pin Item activity, instead launch our own test activities with the
FLAG_ACTIVITY_MULTIPLE_TASK and FLAG_ACTIVITY_NEW_DOCUMENT flags.
Test:
- Locally run testQuickSwitchFromApp() from Android Studio
- flake -oop -t com.android.quickstep.TaplTestsQuickstep#testQuickSwitchFromApp
Bug: 140252765
Change-Id: Ie137261ce65bfd3dd39df78d57784854a026e967
Merged-In: Ie137261ce65bfd3dd39df78d57784854a026e967
Diffstat (limited to 'quickstep')
-rw-r--r-- | quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index d270d762d..8cd3bb61b 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -248,33 +248,32 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @Test @NavigationModeSwitch @PortraitLandscape - @Ignore("Temporarily disabled b/140252765") public void testQuickSwitchFromApp() throws Exception { - startAppFast(getAppPackageName()); startTestActivity(2); - String calculatorPackage = resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR); - startAppFast(calculatorPackage); + startTestActivity(3); + startTestActivity(4); Background background = getAndAssertBackground(); background.quickSwitchToPreviousApp(); assertTrue("The first app we should have quick switched to is not running", - isTestActivityRunning("TestActivity2")); + isTestActivityRunning(3)); background = getAndAssertBackground(); background.quickSwitchToPreviousApp(); if (mLauncher.getNavigationModel() == NavigationModel.THREE_BUTTON) { // 3-button mode toggles between 2 apps, rather than going back further. assertTrue("Second quick switch should have returned to the first app.", - mDevice.wait(Until.hasObject(By.pkg(calculatorPackage)), DEFAULT_UI_TIMEOUT)); + isTestActivityRunning(4)); } else { assertTrue("The second app we should have quick switched to is not running", - isTestActivityRunning("Test Pin Item")); + isTestActivityRunning(2)); } getAndAssertBackground(); } - private boolean isTestActivityRunning(String activityLabel) { - return mDevice.wait(Until.hasObject(By.pkg(getAppPackageName()).text(activityLabel)), + private boolean isTestActivityRunning(int activityNumber) { + return mDevice.wait(Until.hasObject(By.pkg(getAppPackageName()) + .text("TestActivity" + activityNumber)), DEFAULT_UI_TIMEOUT); } @@ -285,7 +284,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { startTestActivity(2); mLauncher.pressHome().quickSwitchToPreviousApp(); assertTrue("The most recent task is not running after quick switching from home", - isTestActivityRunning("TestActivity2")); + isTestActivityRunning(2)); getAndAssertBackground(); } } |