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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestRule.java

Issue 2829943002: Redirecting off-origin navigations in PWAs to CCT. (Closed)
Patch Set: Relaxed the WebApkIntegrationTest Created 3 years, 7 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
Index: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestRule.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestRule.java
index a4548f62f269bef028990592697baa2128bcabb9..b88c910aeba03c3b5ed565222dd7f7e9b45d1441 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestRule.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestRule.java
@@ -15,6 +15,7 @@ import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.chromium.base.test.util.UrlUtils;
+import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.ShortcutHelper;
import org.chromium.chrome.test.ChromeActivityTestRule;
import org.chromium.content.browser.test.util.Criteria;
@@ -116,15 +117,21 @@ public class WebappActivityTestRule extends ChromeActivityTestRule<WebappActivit
}
/**
- * Waits until any loads in progress have completed.
+ * Waits until any loads in progress of the activity under test have completed.
*/
- public void waitUntilIdle() {
+ protected void waitUntilIdle() {
+ waitUntilIdle(getActivity());
+ }
+
+ /**
+ * Waits until any loads in progress of a selected activity have completed.
+ */
+ protected void waitUntilIdle(final ChromeActivity activity) {
getInstrumentation().waitForIdleSync();
CriteriaHelper.pollInstrumentationThread(new Criteria() {
@Override
public boolean isSatisfied() {
- return getActivity().getActivityTab() != null
- && !getActivity().getActivityTab().isLoading();
+ return activity.getActivityTab() != null && !activity.getActivityTab().isLoading();
}
}, STARTUP_TIMEOUT, CriteriaHelper.DEFAULT_POLLING_INTERVAL);

Powered by Google App Engine
This is Rietveld 408576698