summaryrefslogtreecommitdiffstats
path: root/android_webview
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-06 20:47:54 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-06 20:47:54 +0000
commitc3bbe1a10ab29ae8a5c727685a21610c35897147 (patch)
tree0fcf6a9153986bbff8b02bc29b15931dc3769fd0 /android_webview
parent121885f8656df1c881e6bd59534eb74d65ca0888 (diff)
downloadchromium_src-c3bbe1a10ab29ae8a5c727685a21610c35897147.zip
chromium_src-c3bbe1a10ab29ae8a5c727685a21610c35897147.tar.gz
chromium_src-c3bbe1a10ab29ae8a5c727685a21610c35897147.tar.bz2
Revert 249336 "[Android WebView] Stabilize AwZoomTest.testMagnif..."
> [Android WebView] Stabilize AwZoomTest.testMagnification... > > The page that is used for testing is updated to have wide content, so > Blink actually sets up the page scale to the specified 'initial-scale'. > > After loading the page, the test now waits until the page scale becomes > equal to the one specified in 'initial-scale' / 'minimum-scale', which ensures > that the viewport meta tag has been fully processed. This should prevent > the situation when the test discovers that the page can still be zoomed out. > > I have encountered an issue with DCHECKs in > InProcessViewRenderer::SetTotalRootLayerScrollOffset, and had to disable > them. > > BUG=340327,340648 > R=mkosiba@chromium.org > > Review URL: https://codereview.chromium.org/143683005 TBR=mnaganov@chromium.org Review URL: https://codereview.chromium.org/137383014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249491 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r--android_webview/browser/in_process_view_renderer.cc6
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java35
2 files changed, 19 insertions, 22 deletions
diff --git a/android_webview/browser/in_process_view_renderer.cc b/android_webview/browser/in_process_view_renderer.cc
index 25695c0..1becdf1 100644
--- a/android_webview/browser/in_process_view_renderer.cc
+++ b/android_webview/browser/in_process_view_renderer.cc
@@ -852,10 +852,8 @@ void InProcessViewRenderer::SetTotalRootLayerScrollOffset(
DCHECK(0 <= scroll_offset.x());
DCHECK(0 <= scroll_offset.y());
- // Disabled because the conditions are being violated while running
- // AwZoomTest.testMagnification, see http://crbug.com/340648
- // DCHECK(scroll_offset.x() <= max_offset.x());
- // DCHECK(scroll_offset.y() <= max_offset.y());
+ DCHECK(scroll_offset.x() <= max_offset.x());
+ DCHECK(scroll_offset.y() <= max_offset.y());
client_->ScrollContainerViewTo(scroll_offset);
}
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 6c1addd..7bc49b0 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,6 +13,7 @@ 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 java.util.concurrent.Callable;
@@ -33,14 +34,10 @@ public class AwZoomTest extends AwTestBase {
mAwContents = testContainerView.getAwContents();
}
- private String getZoomableHtml(float scale) {
- final int divWidthPercent = (int)((1.0f / scale) * 100.0f);
- return String.format("<html><head><meta name=\"viewport\" content=\"" +
- "width=device-width, minimum-scale=%f, maximum-scale=2.0, initial-scale=%f" +
- "\"/></head><body style='margin:0'>" +
- "<div style='width:%d%%;height:100px;border:1px solid black'>Zoomable</div>" +
- "</body></html>",
- scale, scale, divWidthPercent);
+ private String getZoomableHtml() {
+ return "<html><head><meta name=\"viewport\" content=\"" +
+ "width=device-width, minimum-scale=0.5, maximum-scale=2.0, initial-scale=0.5" +
+ "\"/></head><body>Zoomable</body></html>";
}
private String getNonZoomableHtml() {
@@ -122,11 +119,11 @@ public class AwZoomTest extends AwTestBase {
});
}
- private void waitForScaleToBecome(final float expectedScale) throws Throwable {
+ private void waitUntilCanZoomIn() throws Throwable {
poll(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
- return expectedScale == getScaleOnUiThread(mAwContents);
+ return canZoomInOnUiThread(mAwContents);
}
});
}
@@ -144,10 +141,9 @@ public class AwZoomTest extends AwTestBase {
private void runMagnificationTest() throws Throwable {
getAwSettingsOnUiThread(mAwContents).setUseWideViewPort(true);
assertFalse("Should not be able to zoom in", canZoomInOnUiThread(mAwContents));
- final float pageMinimumScale = 0.5f;
loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
- getZoomableHtml(pageMinimumScale), "text/html", false);
- waitForScaleToBecome(pageMinimumScale);
+ getZoomableHtml(), "text/html", false);
+ waitUntilCanZoomIn();
assertTrue("Should be able to zoom in", canZoomInOnUiThread(mAwContents));
assertFalse("Should not be able to zoom out", canZoomOutOnUiThread(mAwContents));
@@ -162,8 +158,12 @@ public class AwZoomTest extends AwTestBase {
assertTrue("Should be able to zoom in", canZoomInOnUiThread(mAwContents));
}
+ /*
@SmallTest
@Feature({"AndroidWebView"})
+ crbug.com/340327
+ */
+ @DisabledTest
public void testMagnification() throws Throwable {
getAwSettingsOnUiThread(mAwContents).setSupportZoom(true);
runMagnificationTest();
@@ -183,7 +183,7 @@ public class AwZoomTest extends AwTestBase {
public void testZoomUsingMultiTouch() throws Throwable {
AwSettings webSettings = getAwSettingsOnUiThread(mAwContents);
loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
- getZoomableHtml(0.5f), "text/html", false);
+ getZoomableHtml(), "text/html", false);
assertTrue(webSettings.supportZoom());
assertFalse(webSettings.getBuiltInZoomControls());
@@ -202,10 +202,9 @@ public class AwZoomTest extends AwTestBase {
AwSettings webSettings = getAwSettingsOnUiThread(mAwContents);
webSettings.setUseWideViewPort(true);
assertFalse("Should not be able to zoom in", canZoomInOnUiThread(mAwContents));
- final float pageMinimumScale = 0.5f;
loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
- getZoomableHtml(pageMinimumScale), "text/html", false);
- waitForScaleToBecome(pageMinimumScale);
+ getZoomableHtml(), "text/html", false);
+ 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));
@@ -250,7 +249,7 @@ public class AwZoomTest extends AwTestBase {
public void testZoomControlsOnOrientationChange() throws Throwable {
AwSettings webSettings = getAwSettingsOnUiThread(mAwContents);
loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
- getZoomableHtml(0.5f), "text/html", false);
+ getZoomableHtml(), "text/html", false);
assertTrue(webSettings.supportZoom());
webSettings.setBuiltInZoomControls(true);