| Index: chrome/android/javatests/src/org/chromium/chrome/browser/document/DocumentModeTest.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/document/DocumentModeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/document/DocumentModeTest.java
|
| index 8bf72215cd27b345ceabc6e4d2f012f9fc32b747..a158fe8a4cf45a1bae7900776578dfad07a0765b 100644
|
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/document/DocumentModeTest.java
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/document/DocumentModeTest.java
|
| @@ -95,7 +95,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| startTabbedActivity(URL_1);
|
|
|
| // ApplicationStatus should note that the ChromeTabbedActivity isn't running anymore.
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| List<WeakReference<Activity>> activities = ApplicationStatus.getRunningActivities();
|
| @@ -129,7 +129,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
|
|
| // A DocumentActivity gets started, but it should immediately call finishAndRemoveTask()
|
| // because of the broken Intent.
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| Activity activity = ApplicationStatus.getLastTrackedFocusedActivity();
|
| @@ -138,7 +138,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| });
|
|
|
| // We shouldn't record that a new Tab exists.
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return selector.getCurrentModel().getCount() == 3
|
| @@ -170,7 +170,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| // Funnily enough, Android doesn't differentiate between URIs with different queries when
|
| // refocusing Activities based on the Intent data. This means we can't do a check to see
|
| // that the new Activity appears with URL_4 -- we just get a new instance of URL_3.
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| Activity activity = ApplicationStatus.getLastTrackedFocusedActivity();
|
| @@ -185,7 +185,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| });
|
|
|
| // Although we get a new DocumentActivity, the old one with the same tab ID gets killed.
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return selector.getCurrentModel().getCount() == 3
|
| @@ -215,7 +215,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| mContext.startActivity(intent);
|
| ApplicationTestUtils.waitUntilChromeInForeground();
|
|
|
| - CriteriaHelper.pollForCriteria(new Criteria() {
|
| + CriteriaHelper.pollInstrumentationThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return lastTrackedActivity == ApplicationStatus.getLastTrackedFocusedActivity()
|
| @@ -244,7 +244,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| ApplicationTestUtils.fireHomeScreenIntent(mContext);
|
| ApplicationTestUtils.launchChrome(mContext);
|
|
|
| - CriteriaHelper.pollForCriteria(new Criteria() {
|
| + CriteriaHelper.pollInstrumentationThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return !selector.isIncognitoSelected() && lastTabId == selector.getCurrentTabId();
|
| @@ -271,7 +271,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| }
|
| });
|
|
|
| - CriteriaHelper.pollForCriteria(new Criteria() {
|
| + CriteriaHelper.pollInstrumentationThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return !selector.isIncognitoSelected() && selector.getCurrentModel().index() == 0;
|
| @@ -307,7 +307,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| };
|
| ActivityUtils.waitForActivity(getInstrumentation(), ChromeLauncherActivity.class, runnable);
|
| ApplicationTestUtils.waitUntilChromeInForeground();
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| Activity lastActivity = ApplicationStatus.getLastTrackedFocusedActivity();
|
| @@ -319,7 +319,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
|
|
| // Create another tab.
|
| final int secondTabId = launchViaViewIntent(false, URL_2, "Page 2");
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return selector.getModel(false).getCount() == 2
|
| @@ -361,7 +361,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| final DocumentTabModelSelector selector =
|
| ChromeApplication.getDocumentTabModelSelector();
|
| final TabModel incognitoModel = selector.getModel(true);
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return firstId == selector.getCurrentTabId() && selector.getTotalTabCount() == 1;
|
| @@ -370,7 +370,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| assertEquals(incognitoModel, selector.getCurrentModel());
|
|
|
| // Make sure the URL isn't in the Intent of the first IncognitoDocumentActivity.
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return ApplicationStatus.getLastTrackedFocusedActivity()
|
| @@ -382,7 +382,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
|
|
| // Launch via ChromeLauncherActivity.launchInstance().
|
| final int secondId = launchViaLaunchDocumentInstance(true, URL_3, "Page 3");
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return secondId == selector.getCurrentTabId() && selector.getTotalTabCount() == 2;
|
| @@ -393,7 +393,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| assertEquals(secondId, TabModelUtils.getCurrentTabId(incognitoModel));
|
|
|
| // Make sure the URL isn't in the Intent of the second IncognitoDocumentActivity.
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return ApplicationStatus.getLastTrackedFocusedActivity()
|
| @@ -417,7 +417,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| final DocumentTabModelSelector selector =
|
| ChromeApplication.getDocumentTabModelSelector();
|
| final TabModel incognitoModel = selector.getModel(true);
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return firstId == selector.getCurrentTabId() && selector.getTotalTabCount() == 1;
|
| @@ -431,7 +431,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| // The context menu for links in Incognito mode lacks an "Open in new Incognito tab" option.
|
| // Instead, the regular "Open in new tab" option opens a new incognito tab.
|
| openLinkInNewTabViaContextMenu(false, true);
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return firstId == selector.getCurrentTabId() && selector.getTotalTabCount() == 2;
|
| @@ -453,7 +453,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| assertFalse(selector.isIncognitoSelected());
|
|
|
| final int incognitoId = launchViaLaunchDocumentInstance(true, URL_2, "Page 2");
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return selector.isIncognitoSelected() && selector.getCurrentTabId() == incognitoId;
|
| @@ -466,7 +466,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
| ChromeLauncherActivity.getRemoveAllIncognitoTabsIntent(mContext);
|
| closeAllIntent.send();
|
|
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return selector.getCurrentTabId() == regularId;
|
| @@ -513,7 +513,7 @@ public class DocumentModeTest extends DocumentModeTestBase {
|
|
|
| // Re-open the other tab.
|
| TabModelUtils.setIndex(regularTabModel, 0);
|
| - CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
|
| + CriteriaHelper.pollUiThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| return !selector.isIncognitoSelected()
|
|
|