Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4930)

Unified Diff: chrome/test/android/javatests_staging/src/org/chromium/chrome/test/MultiActivityTestBase.java

Issue 1176043002: Make DocumentModeTest less flaky (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/android/javatests_staging/src/org/chromium/chrome/test/MultiActivityTestBase.java
diff --git a/chrome/test/android/javatests_staging/src/org/chromium/chrome/test/MultiActivityTestBase.java b/chrome/test/android/javatests_staging/src/org/chromium/chrome/test/MultiActivityTestBase.java
index 18859fcc56aa2e43dd962ed9b31ac3e68affad82..f659e6e16917d3b42c8c41bcca563269f5c86a2d 100644
--- a/chrome/test/android/javatests_staging/src/org/chromium/chrome/test/MultiActivityTestBase.java
+++ b/chrome/test/android/javatests_staging/src/org/chromium/chrome/test/MultiActivityTestBase.java
@@ -63,6 +63,13 @@ public abstract class MultiActivityTestBase extends RestrictedInstrumentationTes
/** Finishes all tasks Chrome has listed in Android's Overview. */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void finishAllChromeTasks(final Context context) throws Exception {
+ // Go to the Home screen so that Android has no good reason to keep Chrome Activities alive.
+ Intent homeIntent = new Intent(Intent.ACTION_MAIN);
+ homeIntent.addCategory(Intent.CATEGORY_HOME);
+ homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ context.startActivity(homeIntent);
+
+ // Close all of the tasks one by one.
ActivityManager activityManager =
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.AppTask task : activityManager.getAppTasks()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698