| Index: chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
|
| index efc9f598e3a80eaf33c40180630a0967056a1576..63e2be70fb55c55dbcd5ec1d98faba1deb9432d3 100644
|
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
|
| @@ -172,7 +172,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
|
| * @param text The string to wait for the selection to become.
|
| */
|
| public void waitForSelectionToBe(final String text) throws InterruptedException {
|
| - CriteriaHelper.pollForCriteria(Criteria.equals(text, new Callable<String>() {
|
| + CriteriaHelper.pollInstrumentationThread(Criteria.equals(text, new Callable<String>() {
|
| @Override
|
| public String call() {
|
| return getSelectedText();
|
| @@ -186,12 +186,13 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
|
| */
|
| public void waitForSearchTermResolutionToStart(
|
| final ContextualSearchFakeServer.FakeTapSearch search) throws InterruptedException {
|
| - CriteriaHelper.pollForCriteria(new Criteria("Fake Search Term Resolution never started.") {
|
| - @Override
|
| - public boolean isSatisfied() {
|
| - return search.didStartSearchTermResolution();
|
| - }
|
| - }, TEST_TIMEOUT, DEFAULT_POLLING_INTERVAL);
|
| + CriteriaHelper.pollInstrumentationThread(
|
| + new Criteria("Fake Search Term Resolution never started.") {
|
| + @Override
|
| + public boolean isSatisfied() {
|
| + return search.didStartSearchTermResolution();
|
| + }
|
| + }, TEST_TIMEOUT, DEFAULT_POLLING_INTERVAL);
|
| }
|
|
|
| /**
|
| @@ -200,7 +201,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
|
| */
|
| public void waitForSearchTermResolutionToFinish(
|
| final ContextualSearchFakeServer.FakeTapSearch search) throws InterruptedException {
|
| - CriteriaHelper.pollForCriteria(new Criteria("Fake Search was never ready.") {
|
| + CriteriaHelper.pollInstrumentationThread(new Criteria("Fake Search was never ready.") {
|
| @Override
|
| public boolean isSatisfied() {
|
| return search.didFinishSearchTermResolution();
|
| @@ -627,7 +628,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
|
| */
|
| private void waitForPanelToEnterState(final PanelState state)
|
| throws InterruptedException {
|
| - CriteriaHelper.pollForCriteria(new Criteria() {
|
| + CriteriaHelper.pollInstrumentationThread(new Criteria() {
|
| @Override
|
| public boolean isSatisfied() {
|
| if (mPanel == null) return false;
|
| @@ -668,12 +669,13 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
|
| * @throws InterruptedException
|
| */
|
| private void waitForGestureProcessing() throws InterruptedException {
|
| - CriteriaHelper.pollForCriteria(new Criteria("Gesture processing did not complete.") {
|
| - @Override
|
| - public boolean isSatisfied() {
|
| - return !mSelectionController.wasAnyTapGestureDetected();
|
| - }
|
| - }, TEST_TIMEOUT, DEFAULT_POLLING_INTERVAL);
|
| + CriteriaHelper.pollInstrumentationThread(
|
| + new Criteria("Gesture processing did not complete.") {
|
| + @Override
|
| + public boolean isSatisfied() {
|
| + return !mSelectionController.wasAnyTapGestureDetected();
|
| + }
|
| + }, TEST_TIMEOUT, DEFAULT_POLLING_INTERVAL);
|
| }
|
|
|
| /**
|
| @@ -698,7 +700,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
|
| * and a subsequent tap may think there's a current selection until it has been dissolved.
|
| */
|
| private void waitForSelectionDissolved() throws InterruptedException {
|
| - CriteriaHelper.pollForCriteria(new Criteria("Selection never dissolved.") {
|
| + CriteriaHelper.pollInstrumentationThread(new Criteria("Selection never dissolved.") {
|
| @Override
|
| public boolean isSatisfied() {
|
| return !mSelectionController.isSelectionEstablished();
|
| @@ -1372,7 +1374,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
|
| });
|
|
|
| // Give the panelState time to change
|
| - CriteriaHelper.pollForCriteria(new Criteria(){
|
| + CriteriaHelper.pollInstrumentationThread(new Criteria(){
|
| @Override
|
| public boolean isSatisfied() {
|
| PanelState panelState = mPanel.getPanelState();
|
| @@ -1676,12 +1678,13 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
|
| * Asserts whether the App Menu is visible.
|
| */
|
| private void assertAppMenuVisibility(final boolean isVisible) throws InterruptedException {
|
| - CriteriaHelper.pollForCriteria(Criteria.equals(isVisible, new Callable<Boolean>() {
|
| - @Override
|
| - public Boolean call() {
|
| - return getActivity().getAppMenuHandler().isAppMenuShowing();
|
| - }
|
| - }));
|
| + CriteriaHelper.pollInstrumentationThread(
|
| + Criteria.equals(isVisible, new Callable<Boolean>() {
|
| + @Override
|
| + public Boolean call() {
|
| + return getActivity().getAppMenuHandler().isAppMenuShowing();
|
| + }
|
| + }));
|
| }
|
|
|
| /**
|
| @@ -1894,7 +1897,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
|
|
|
| private void assertWaitForSelectActionBarVisible(final boolean visible)
|
| throws InterruptedException {
|
| - CriteriaHelper.pollForUIThreadCriteria(Criteria.equals(visible, new Callable<Boolean>() {
|
| + CriteriaHelper.pollUiThread(Criteria.equals(visible, new Callable<Boolean>() {
|
| @Override
|
| public Boolean call() {
|
| return getActivity().getActivityTab().getContentViewCore()
|
|
|