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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java

Issue 1950983008: Use waitForActivity in CustomTabActivityTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« 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/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
index 4930fd567c837c6ffde9fcaf137d167f5aa4ae36..3ca828e858ed6fb4e84857b198f5e67bccb2e6e9 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
@@ -1258,14 +1258,14 @@ public class CustomTabActivityTest extends CustomTabActivityTestBase {
assertNull(mActivity.getActivityTab());
}
});
- CriteriaHelper.pollInstrumentationThread(new Criteria() {
- @Override
- public boolean isSatisfied() {
- return getInstrumentation().checkMonitorHit(monitor, 1);
- }
- });
- assertTrue(monitor.getLastActivity() instanceof ChromeActivity);
- final ChromeActivity newActivity = (ChromeActivity) monitor.getLastActivity();
+ // Use the extended CriteriaHelper timeout to make sure we get an activity
+ final Activity lastActivity =
+ monitor.waitForActivityWithTimeout(CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL);
+ assertNotNull("Monitor did not get an activity before hitting the timeout", lastActivity);
+ assertTrue("Expected lastActivity to be a ChromeActivity, was "
+ + lastActivity.getClass().getName(),
+ lastActivity instanceof ChromeActivity);
+ final ChromeActivity newActivity = (ChromeActivity) lastActivity;
CriteriaHelper.pollUiThread((new Criteria() {
@Override
public boolean isSatisfied() {
« 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