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

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java

Issue 131743020: [android_webivew] Refactor polling checks in test code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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: android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java
index 6bd5df1dc568b46dec200db67e7a1c7bc94ebf85..c09c41ebee6e35dc25a2a7dc950073a82072699b 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java
@@ -13,14 +13,13 @@ import org.chromium.android_webview.test.util.JSUtils;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.LoadUrlParams;
import org.chromium.content.browser.test.util.CallbackHelper;
-import org.chromium.content.browser.test.util.Criteria;
-import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageStartedHelper;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnReceivedErrorHelper;
import org.chromium.net.test.util.TestWebServer;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
/**
@@ -615,12 +614,12 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase {
clickOnLinkUsingJs(awContents, contentsClient);
// Wait for the target URL to be fetched from the server.
- assertTrue(CriteriaHelper.pollForCriteria(new Criteria() {
+ poll(new Callable<Boolean>() {
@Override
- public boolean isSatisfied() {
+ public Boolean call() throws Exception {
return mWebServer.getRequestCount(REDIRECT_TARGET_PATH) == 1;
}
- }, WAIT_TIMEOUT_MS, CHECK_INTERVAL));
+ });
// Since the targetURL was loaded from the test server it means all processing related
// to dispatching a shouldOverrideUrlLoading callback had finished and checking the call
@@ -655,12 +654,12 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase {
shouldOverrideUrlLoadingHelper.waitForCallback(shouldOverrideUrlLoadingCallCount);
// Wait for the target URL to be fetched from the server.
- assertTrue(CriteriaHelper.pollForCriteria(new Criteria() {
+ poll(new Callable<Boolean>() {
@Override
- public boolean isSatisfied() {
+ public Boolean call() throws Exception {
return mWebServer.getRequestCount(REDIRECT_TARGET_PATH) == 1;
}
- }, WAIT_TIMEOUT_MS, CHECK_INTERVAL));
+ });
assertEquals(redirectTargetUrl,
shouldOverrideUrlLoadingHelper.getShouldOverrideUrlLoadingUrl());
@@ -690,12 +689,12 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase {
loadUrlSync(awContents, contentsClient.getOnPageFinishedHelper(), pageWithIframeUrl);
// Wait for the redirect target URL to be fetched from the server.
- assertTrue(CriteriaHelper.pollForCriteria(new Criteria() {
+ poll(new Callable<Boolean>() {
@Override
- public boolean isSatisfied() {
+ public Boolean call() throws Exception {
return mWebServer.getRequestCount(REDIRECT_TARGET_PATH) == 1;
}
- }, WAIT_TIMEOUT_MS, CHECK_INTERVAL));
+ });
assertEquals(shouldOverrideUrlLoadingCallCount,
shouldOverrideUrlLoadingHelper.getCallCount());

Powered by Google App Engine
This is Rietveld 408576698