summaryrefslogtreecommitdiffstats
path: root/android_webview/javatests
diff options
context:
space:
mode:
authormnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-28 15:55:18 +0000
committermnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-28 15:55:18 +0000
commitbf4cb744862a90ca05065b2b8b0e0259b835285c (patch)
treef8eec30e20de2f3f3bc52d9774fe52812560ac66 /android_webview/javatests
parent7d58bf37d5dbea099064812bc3416494de599a60 (diff)
downloadchromium_src-bf4cb744862a90ca05065b2b8b0e0259b835285c.zip
chromium_src-bf4cb744862a90ca05065b2b8b0e0259b835285c.tar.gz
chromium_src-bf4cb744862a90ca05065b2b8b0e0259b835285c.tar.bz2
[Android WebView] Fix AwZoomTest tests
The following tests were broken long ago during compositor evolution: AwZoomTest#testMagnification AwZoomTest#testMagnificationWithZoomSupportOff AwZoomTest#testZoomControls Updated them to pass with the current code. BUG=239144 R=mkosiba@chromium.org Review URL: https://codereview.chromium.org/94993002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237792 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/javatests')
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwViewportTest.java1
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java47
2 files changed, 26 insertions, 22 deletions
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 8492ad2..43f5e32 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
@@ -7,7 +7,6 @@ package org.chromium.android_webview.test;
import android.test.suitebuilder.annotation.MediumTest;
import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.AwSettings;
-import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.test.util.CallbackHelper;
import org.chromium.content.browser.test.util.Criteria;
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 8e55c8a..c410c68 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
@@ -13,7 +13,6 @@ import android.view.ViewConfiguration;
import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.AwSettings;
import org.chromium.base.ThreadUtils;
-import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
@@ -132,6 +131,21 @@ public class AwZoomTest extends AwTestBase {
}, TEST_TIMEOUT_MS, CHECK_INTERVAL_MS);
}
+ private boolean waitUntilCanZoomIn() throws Throwable {
+ return CriteriaHelper.pollForCriteria(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ try {
+ return canZoomInOnUiThread(mAwContents);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ fail("Failed to query canZoomIn: " + t.toString());
+ return false;
+ }
+ }
+ }, TEST_TIMEOUT_MS, CHECK_INTERVAL_MS);
+ }
+
private boolean waitUntilCanNotZoom() throws Throwable {
return CriteriaHelper.pollForCriteria(new Criteria() {
@Override
@@ -148,12 +162,12 @@ public class AwZoomTest extends AwTestBase {
}, TEST_TIMEOUT_MS, CHECK_INTERVAL_MS);
}
- private void runMagnificationTest(boolean supportZoom) throws Throwable {
- int onScaleChangedCallCount = mContentsClient.getOnScaleChangedHelper().getCallCount();
+ private void runMagnificationTest() throws Throwable {
+ getAwSettingsOnUiThread(mAwContents).setUseWideViewPort(true);
+ assertFalse("Should not be able to zoom in", canZoomInOnUiThread(mAwContents));
loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
getZoomableHtml(), "text/html", false);
- mContentsClient.getOnScaleChangedHelper().waitForCallback(onScaleChangedCallCount);
- getAwSettingsOnUiThread(mAwContents).setSupportZoom(supportZoom);
+ waitUntilCanZoomIn();
assertTrue("Should be able to zoom in", canZoomInOnUiThread(mAwContents));
assertFalse("Should not be able to zoom out", canZoomOutOnUiThread(mAwContents));
@@ -168,26 +182,20 @@ public class AwZoomTest extends AwTestBase {
assertTrue("Should be able to zoom in", canZoomInOnUiThread(mAwContents));
}
- /*
@SmallTest
@Feature({"AndroidWebView"})
- http://crbug.com/239144
- */
- @DisabledTest
public void testMagnification() throws Throwable {
- runMagnificationTest(true);
+ getAwSettingsOnUiThread(mAwContents).setSupportZoom(true);
+ runMagnificationTest();
}
// According to Android CTS test, zoomIn/Out must work
// even if supportZoom is turned off.
- /*
@SmallTest
@Feature({"AndroidWebView"})
- http://crbug.com/239144
- */
- @DisabledTest
public void testMagnificationWithZoomSupportOff() throws Throwable {
- runMagnificationTest(false);
+ getAwSettingsOnUiThread(mAwContents).setSupportZoom(false);
+ runMagnificationTest();
}
@SmallTest
@@ -208,18 +216,15 @@ public class AwZoomTest extends AwTestBase {
assertFalse(isMultiTouchZoomSupportedOnUiThread());
}
- /*
@SmallTest
@Feature({"AndroidWebView"})
- http://crbug.com/239144
- */
- @DisabledTest
public void testZoomControls() throws Throwable {
AwSettings webSettings = getAwSettingsOnUiThread(mAwContents);
- int onScaleChangedCallCount = mContentsClient.getOnScaleChangedHelper().getCallCount();
+ webSettings.setUseWideViewPort(true);
+ assertFalse("Should not be able to zoom in", canZoomInOnUiThread(mAwContents));
loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
getZoomableHtml(), "text/html", false);
- mContentsClient.getOnScaleChangedHelper().waitForCallback(onScaleChangedCallCount);
+ waitUntilCanZoomIn();
// It must be possible to zoom in (or zoom out) for zoom controls to be shown
assertTrue("Should be able to zoom in", canZoomInOnUiThread(mAwContents));