summaryrefslogtreecommitdiffstats
path: root/android_webview
diff options
context:
space:
mode:
authoreugenis@chromium.org <eugenis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-13 11:51:15 +0000
committereugenis@chromium.org <eugenis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-13 11:51:15 +0000
commit34d79d57f10a167a63f5040954965c2c8d45421e (patch)
tree6ccdfd5e7a08349d997bf77ac59d3bdd26ed2144 /android_webview
parent407d82b346ee97ed1930cd4ba60cc1e9a28210ea (diff)
downloadchromium_src-34d79d57f10a167a63f5040954965c2c8d45421e.zip
chromium_src-34d79d57f10a167a63f5040954965c2c8d45421e.tar.gz
chromium_src-34d79d57f10a167a63f5040954965c2c8d45421e.tar.bz2
Scale several timeouts in Android tests.
This change increases timeout values when running under tools like AddressSanitizer and Valgrind. TEST=ASan/Android FYI bot should become a bit greener BUG=325685 R=bulach@chromium.org, mkosiba@chromium.org, mnaganov@chromium.org, yfriedman@chromium.org Review URL: https://codereview.chromium.org/99253008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240598 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java10
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java4
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java3
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java4
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java11
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java7
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java13
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java32
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwViewportTest.java5
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java9
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java10
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java4
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/FullScreenVideoTestAwContentsClient.java6
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java4
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/LoadUrlTest.java6
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java6
16 files changed, 64 insertions, 70 deletions
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java
index a8d654e..8df51eb 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java
@@ -27,8 +27,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
* Integration tests for synchronous scrolling.
*/
public class AndroidScrollIntegrationTest extends AwTestBase {
- private static final int SCROLL_OFFSET_PROPAGATION_TIMEOUT_MS = 6 * 1000;
-
private static class OverScrollByCallbackHelper extends CallbackHelper {
int mDeltaX;
int mDeltaY;
@@ -211,7 +209,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
return false;
}
}
- }, WAIT_TIMEOUT_SECONDS * 1000, CHECK_INTERVAL));
+ }, WAIT_TIMEOUT_MS, CHECK_INTERVAL));
}
private void assertScrolledToBottomInJs(final AwContents awContents,
@@ -231,7 +229,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
return false;
}
}
- }, WAIT_TIMEOUT_SECONDS * 1000, CHECK_INTERVAL));
+ }, WAIT_TIMEOUT_MS, CHECK_INTERVAL));
}
private void loadTestPageAndWaitForFirstFrame(final ScrollTestContainerView testContainerView,
@@ -257,7 +255,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
// tree activations to stop clobbering the root scroll layer's scroll offset. This wait
// doesn't strictly guarantee that but there isn't a good alternative and this seems to
// work fine.
- firstFrameObserver.waitForEvent(WAIT_TIMEOUT_SECONDS * 1000);
+ firstFrameObserver.waitForEvent(WAIT_TIMEOUT_MS);
}
@SmallTest
@@ -288,7 +286,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
scrollToOnMainSync(testContainerView, targetScrollXPix, targetScrollYPix);
- onscrollObserver.waitForEvent(SCROLL_OFFSET_PROPAGATION_TIMEOUT_MS);
+ onscrollObserver.waitForEvent(WAIT_TIMEOUT_MS);
assertScrollInJs(testContainerView.getAwContents(), contentsClient,
targetScrollXCss, targetScrollYCss);
}
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java
index f4395ae..70a1150 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/ArchiveTest.java
@@ -7,6 +7,8 @@ package org.chromium.android_webview.test;
import android.test.suitebuilder.annotation.SmallTest;
import android.webkit.ValueCallback;
+import static org.chromium.base.test.util.ScalableTimeout.ScaleTimeout;
+
import org.chromium.android_webview.AwContents;
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.Feature;
@@ -19,7 +21,7 @@ import java.util.concurrent.atomic.AtomicReference;
public class ArchiveTest extends AwTestBase {
- private static final long TEST_TIMEOUT = 20000L;
+ private static final long TEST_TIMEOUT = ScaleTimeout(20000L);
private static final String TEST_PAGE = UrlUtils.encodeHtmlDataUri(
"<html><head></head><body>test</body></html>");
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java
index 68e4c33..b3c261d 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java
@@ -40,7 +40,8 @@ public class AwContentsClientGetVideoLoadingProgressViewTest extends AwTestBase
}
private void waitForViewAttached() throws InterruptedException, TimeoutException {
- mViewAttachedCallbackHelper.waitForCallback(0, 1, 20, TimeUnit.SECONDS);
+ mViewAttachedCallbackHelper.waitForCallback(0, 1, WAIT_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
}
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java
index 34d2168..b842ea8 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java
@@ -7,6 +7,8 @@ package org.chromium.android_webview.test;
import android.os.Message;
import android.test.suitebuilder.annotation.SmallTest;
+import static org.chromium.base.test.util.ScalableTimeout.ScaleTimeout;
+
import org.apache.http.util.EncodingUtils;
import org.chromium.android_webview.AwContents;
import org.chromium.base.test.util.DisabledTest;
@@ -54,7 +56,7 @@ public class AwContentsClientOnFormResubmissionTest extends AwTestBase {
"<html><head><title>Reload</title></head><body>HELLO</body></html>";
// Server timeout in seconds. Used to detect dontResend case.
- private static final int TIMEOUT = 3;
+ private static final long TIMEOUT = ScaleTimeout(3);
// The web server.
private TestWebServer mServer;
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 9b8ee73..6bd5df1 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
@@ -32,9 +32,6 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase {
private static final String REDIRECT_TARGET_PATH = "/redirect_target.html";
private static final String TITLE = "TITLE";
- private static final long TEST_TIMEOUT = 20000L;
- private static final long CHECK_INTERVAL = 100;
-
private static class TestAwContentsClient
extends org.chromium.android_webview.test.TestAwContentsClient {
@@ -623,7 +620,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase {
public boolean isSatisfied() {
return mWebServer.getRequestCount(REDIRECT_TARGET_PATH) == 1;
}
- }, WAIT_TIMEOUT_SECONDS * 1000L, CHECK_INTERVAL));
+ }, 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
@@ -663,7 +660,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase {
public boolean isSatisfied() {
return mWebServer.getRequestCount(REDIRECT_TARGET_PATH) == 1;
}
- }, WAIT_TIMEOUT_SECONDS * 1000L, CHECK_INTERVAL));
+ }, WAIT_TIMEOUT_MS, CHECK_INTERVAL));
assertEquals(redirectTargetUrl,
shouldOverrideUrlLoadingHelper.getShouldOverrideUrlLoadingUrl());
@@ -698,7 +695,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase {
public boolean isSatisfied() {
return mWebServer.getRequestCount(REDIRECT_TARGET_PATH) == 1;
}
- }, WAIT_TIMEOUT_SECONDS * 1000L, CHECK_INTERVAL));
+ }, WAIT_TIMEOUT_MS, CHECK_INTERVAL));
assertEquals(shouldOverrideUrlLoadingCallCount,
shouldOverrideUrlLoadingHelper.getCallCount());
@@ -861,7 +858,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase {
}
});
contentsClient.getOnPageFinishedHelper().waitForCallback(currentCallCount, 1,
- WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
+ WAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
assertEquals(0, shouldOverrideUrlLoadingHelper.getCallCount());
}
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java
index e2b849c..9e4615d 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java
@@ -213,7 +213,7 @@ public class AwContentsTest extends AwTestBase {
awContents.documentHasImages(msg);
}
});
- assertTrue(s.tryAcquire(WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS));
+ assertTrue(s.tryAcquire(WAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS));
int result = val.get();
return result;
}
@@ -311,9 +311,6 @@ public class AwContentsTest extends AwTestBase {
});
}
- private static final long TEST_TIMEOUT = 20000L;
- private static final int CHECK_INTERVAL = 100;
-
@SmallTest
@Feature({"AndroidWebView"})
public void testGetFavicon() throws Throwable {
@@ -447,6 +444,6 @@ public class AwContentsTest extends AwTestBase {
"javascript:window.bridge.run();");
}
});
- callback.waitForCallback(0, 1, 20, TimeUnit.SECONDS);
+ callback.waitForCallback(0, 1, WAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
}
}
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java
index a588c89..f7f81ff 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java
@@ -48,9 +48,6 @@ import java.util.regex.Pattern;
* application
*/
public class AwSettingsTest extends AwTestBase {
- private static final long TEST_TIMEOUT = 20000L;
- private static final int CHECK_INTERVAL = 100;
-
private static final boolean ENABLED = true;
private static final boolean DISABLED = false;
@@ -942,7 +939,7 @@ public class AwSettingsTest extends AwTestBase {
return false;
}
}
- }, TEST_TIMEOUT, CHECK_INTERVAL));
+ }, WAIT_TIMEOUT_MS, CHECK_INTERVAL));
mNeedToWaitForFontSizeChange = false;
}
return Float.parseFloat(getTitleOnUiThread());
@@ -1163,7 +1160,7 @@ public class AwSettingsTest extends AwTestBase {
return false;
}
}
- }, TEST_TIMEOUT, CHECK_INTERVAL));
+ }, WAIT_TIMEOUT_MS, CHECK_INTERVAL));
assertEquals(value ? POPUP_ENABLED : POPUP_BLOCKED, getTitleOnUiThread());
}
@@ -1458,7 +1455,7 @@ public class AwSettingsTest extends AwTestBase {
return false;
}
}
- }, TEST_TIMEOUT, CHECK_INTERVAL));
+ }, WAIT_TIMEOUT_MS, CHECK_INTERVAL));
assertEquals(ImagePageGenerator.IMAGE_LOADED_STRING, getTitleOnUiThread(awContents));
}
@@ -1840,7 +1837,7 @@ public class AwSettingsTest extends AwTestBase {
return false;
}
}
- }, TEST_TIMEOUT, CHECK_INTERVAL));
+ }, WAIT_TIMEOUT_MS, CHECK_INTERVAL));
} finally {
if (webServer != null) webServer.shutdown();
}
@@ -2256,7 +2253,7 @@ public class AwSettingsTest extends AwTestBase {
public boolean isSatisfied() {
return mWebServer.getRequestCount(path) > initialRequestCount;
}
- }, TEST_TIMEOUT, CHECK_INTERVAL));
+ }, WAIT_TIMEOUT_MS, CHECK_INTERVAL));
return mWebServer.getRequestCount(path);
}
}
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
index b9c34917..dba2b7b 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
@@ -8,6 +8,8 @@ import android.app.Instrumentation;
import android.content.Context;
import android.test.ActivityInstrumentationTestCase2;
+import static org.chromium.base.test.util.ScalableTimeout.ScaleTimeout;
+
import org.chromium.android_webview.AwBrowserContext;
import org.chromium.android_webview.AwBrowserProcess;
import org.chromium.android_webview.AwContents;
@@ -32,7 +34,7 @@ import java.util.concurrent.atomic.AtomicReference;
*/
public class AwTestBase
extends ActivityInstrumentationTestCase2<AwTestRunnerActivity> {
- protected static final int WAIT_TIMEOUT_SECONDS = 15;
+ protected static final long WAIT_TIMEOUT_MS = ScaleTimeout(15000);
protected static final int CHECK_INTERVAL = 100;
public AwTestBase() {
@@ -103,8 +105,8 @@ public class AwTestBase
final String url) throws Exception {
int currentCallCount = onPageFinishedHelper.getCallCount();
loadUrlAsync(awContents, url);
- onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_SECONDS,
- TimeUnit.SECONDS);
+ onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
}
protected void loadUrlSyncAndExpectError(final AwContents awContents,
@@ -114,10 +116,10 @@ public class AwTestBase
int onErrorCallCount = onReceivedErrorHelper.getCallCount();
int onFinishedCallCount = onPageFinishedHelper.getCallCount();
loadUrlAsync(awContents, url);
- onReceivedErrorHelper.waitForCallback(onErrorCallCount, 1, WAIT_TIMEOUT_SECONDS,
- TimeUnit.SECONDS);
- onPageFinishedHelper.waitForCallback(onFinishedCallCount, 1, WAIT_TIMEOUT_SECONDS,
- TimeUnit.SECONDS);
+ onReceivedErrorHelper.waitForCallback(onErrorCallCount, 1, WAIT_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
+ onPageFinishedHelper.waitForCallback(onFinishedCallCount, 1, WAIT_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
}
/**
@@ -141,8 +143,8 @@ public class AwTestBase
byte[] postData) throws Exception {
int currentCallCount = onPageFinishedHelper.getCallCount();
postUrlAsync(awContents, url, postData);
- onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_SECONDS,
- TimeUnit.SECONDS);
+ onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
}
/**
@@ -173,8 +175,8 @@ public class AwTestBase
final boolean isBase64Encoded) throws Exception {
int currentCallCount = onPageFinishedHelper.getCallCount();
loadDataAsync(awContents, data, mimeType, isBase64Encoded);
- onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_SECONDS,
- TimeUnit.SECONDS);
+ onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
}
protected void loadDataSyncWithCharset(final AwContents awContents,
@@ -190,8 +192,8 @@ public class AwTestBase
data, mimeType, isBase64Encoded, charset));
}
});
- onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_SECONDS,
- TimeUnit.SECONDS);
+ onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
}
/**
@@ -221,8 +223,8 @@ public class AwTestBase
awContents.getContentViewCore().reload(true);
}
});
- onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_SECONDS,
- TimeUnit.SECONDS);
+ onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
}
/**
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwViewportTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwViewportTest.java
index fab8098..ebac2f8 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwViewportTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwViewportTest.java
@@ -305,9 +305,6 @@ public class AwViewportTest extends AwTestBase {
return false;
}
}
- }, TEST_TIMEOUT_MS, CHECK_INTERVAL_MS);
+ }, WAIT_TIMEOUT_MS, CHECK_INTERVAL);
}
-
- private static final long TEST_TIMEOUT_MS = 20000L;
- private static final int CHECK_INTERVAL_MS = 100;
}
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java
index a83a93c..6155461 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java
@@ -23,9 +23,6 @@ import java.util.concurrent.Callable;
* A test suite for zooming-related methods and settings.
*/
public class AwZoomTest extends AwTestBase {
- private static final long TEST_TIMEOUT_MS = 20000L;
- private static final int CHECK_INTERVAL_MS = 100;
-
private TestAwContentsClient mContentsClient;
private AwContents mAwContents;
@@ -128,7 +125,7 @@ public class AwZoomTest extends AwTestBase {
return false;
}
}
- }, TEST_TIMEOUT_MS, CHECK_INTERVAL_MS);
+ }, WAIT_TIMEOUT_MS, CHECK_INTERVAL);
}
private boolean waitUntilCanZoomIn() throws Throwable {
@@ -143,7 +140,7 @@ public class AwZoomTest extends AwTestBase {
return false;
}
}
- }, TEST_TIMEOUT_MS, CHECK_INTERVAL_MS);
+ }, WAIT_TIMEOUT_MS, CHECK_INTERVAL);
}
private boolean waitUntilCanNotZoom() throws Throwable {
@@ -159,7 +156,7 @@ public class AwZoomTest extends AwTestBase {
return false;
}
}
- }, TEST_TIMEOUT_MS, CHECK_INTERVAL_MS);
+ }, WAIT_TIMEOUT_MS, CHECK_INTERVAL);
}
private void runMagnificationTest() throws Throwable {
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java
index fd40108..14a7001 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java
@@ -61,12 +61,12 @@ public class ClientOnPageFinishedTest extends AwTestBase {
onReceivedErrorHelper.waitForCallback(onReceivedErrorCallCount,
1 /* numberOfCallsToWaitFor */,
- WAIT_TIMEOUT_SECONDS,
- TimeUnit.SECONDS);
+ WAIT_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
onPageFinishedHelper.waitForCallback(onPageFinishedCallCount,
- 1 /* numberOfCallsToWaitFor */,
- WAIT_TIMEOUT_SECONDS,
- TimeUnit.SECONDS);
+ 1 /* numberOfCallsToWaitFor */,
+ WAIT_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
assertEquals(1, onReceivedErrorHelper.getCallCount());
}
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java
index 064e9e6..ddb3b65 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java
@@ -43,8 +43,8 @@ public class ClientOnReceivedErrorTest extends AwTestBase {
onReceivedErrorHelper.waitForCallback(onReceivedErrorCallCount,
1 /* numberOfCallsToWaitFor */,
- WAIT_TIMEOUT_SECONDS,
- TimeUnit.SECONDS);
+ WAIT_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
assertEquals(ErrorCodeConversionHelper.ERROR_HOST_LOOKUP,
onReceivedErrorHelper.getErrorCode());
assertEquals(url, onReceivedErrorHelper.getFailingUrl());
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/FullScreenVideoTestAwContentsClient.java b/android_webview/javatests/src/org/chromium/android_webview/test/FullScreenVideoTestAwContentsClient.java
index 29fd74a..4521c86 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/FullScreenVideoTestAwContentsClient.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/FullScreenVideoTestAwContentsClient.java
@@ -12,6 +12,8 @@ import android.view.WindowManager;
import android.webkit.WebChromeClient;
import android.widget.FrameLayout;
+import static org.chromium.base.test.util.ScalableTimeout.ScaleTimeout;
+
import org.chromium.content.browser.test.util.CallbackHelper;
import java.util.concurrent.TimeUnit;
@@ -21,7 +23,7 @@ import java.util.concurrent.TimeoutException;
* This class is a AwContentsClient for full screen video test.
*/
public class FullScreenVideoTestAwContentsClient extends TestAwContentsClient {
- public static final int WAITING_SECONDS = 20;
+ public static final long WAITING_SECONDS = ScaleTimeout(20);
private CallbackHelper mOnShowCustomViewCallbackHelper = new CallbackHelper();
private CallbackHelper mOnHideCustomViewCallbackHelper = new CallbackHelper();
@@ -58,4 +60,4 @@ public class FullScreenVideoTestAwContentsClient extends TestAwContentsClient {
public void waitForCustomViewHidden() throws InterruptedException, TimeoutException {
mOnHideCustomViewCallbackHelper.waitForCallback(0, 1, WAITING_SECONDS, TimeUnit.SECONDS);
}
-} \ No newline at end of file
+}
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java
index 59c3820..1b75c12 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java
@@ -51,8 +51,8 @@ public class LoadDataWithBaseUrlTest extends AwTestBase {
mContentsClient.getOnPageFinishedHelper();
int currentCallCount = onPageFinishedHelper.getCallCount();
loadDataWithBaseUrlAsync(data, mimeType, isBase64Encoded, baseUrl, historyUrl);
- onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_SECONDS,
- TimeUnit.SECONDS);
+ onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
}
protected void loadDataWithBaseUrlAsync(
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/LoadUrlTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/LoadUrlTest.java
index ce9db87..71649cb 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/LoadUrlTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/LoadUrlTest.java
@@ -95,8 +95,8 @@ public class LoadUrlTest extends AwTestBase {
awContents.loadUrl(params);
}
});
- onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_SECONDS,
- TimeUnit.SECONDS);
+ onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
}
private static List<Pair<String, String>> createHeadersList(String[] namesAndValues) {
@@ -316,7 +316,7 @@ public class LoadUrlTest extends AwTestBase {
contentsClient.getOnEvaluateJavaScriptResultHelper(),
"next");
contentsClient.getOnPageFinishedHelper().waitForCallback(
- currentCallCount, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
+ currentCallCount, 1, WAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
// No extra headers for the page navigated via clicking.
validateNoRequestHeaders(extraHeaders, webServer.getLastRequest(nextPath));
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java b/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java
index 1f6a5bc..d6dfa49 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java
@@ -8,6 +8,8 @@ import android.test.InstrumentationTestCase;
import junit.framework.Assert;
+import static org.chromium.base.test.util.ScalableTimeout.ScaleTimeout;
+
import org.chromium.android_webview.AwContents;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
@@ -19,7 +21,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* Collection of functions for JavaScript-based interactions with a page.
*/
public class JSUtils {
- private static final int WAIT_TIMEOUT_SECONDS = 2;
+ private static final long WAIT_TIMEOUT_MS = ScaleTimeout(2000);
private static final int CHECK_INTERVAL = 100;
public static void clickOnLinkUsingJs(
@@ -42,7 +44,7 @@ public class JSUtils {
return false;
}
}
- }, WAIT_TIMEOUT_SECONDS * 1000, CHECK_INTERVAL));
+ }, WAIT_TIMEOUT_MS, CHECK_INTERVAL));
testCase.getInstrumentation().runOnMainSync(new Runnable() {
@Override