Index: Source/web/tests/WebFrameTest.cpp |
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp |
index 41ff97db2763908f5fce07d29850c639035fdb70..ff2ff8b37db8c8b726ac03b565408e25bd7b8dfe 100644 |
--- a/Source/web/tests/WebFrameTest.cpp |
+++ b/Source/web/tests/WebFrameTest.cpp |
@@ -917,6 +917,35 @@ TEST_F(WebFrameTest, ZeroValuesQuirk) |
EXPECT_EQ(1.0f, m_webView->pageScaleFactor()); |
} |
+TEST_F(WebFrameTest, NonZeroValuesNoQuirk) |
+{ |
+ registerMockedHttpURLLoad("viewport-nonzero-values.html"); |
+ |
+ FixedLayoutTestWebViewClient client; |
+ client.m_screenInfo.deviceScaleFactor = 1; |
+ int viewportWidth = 640; |
+ int viewportHeight = 480; |
+ float expectedPageScaleFactor = 0.5f; |
+ |
+ m_webView = FrameTestHelpers::createWebView(true, 0, &client); |
+ m_webView->enableFixedLayoutMode(true); |
+ m_webView->settings()->setViewportEnabled(true); |
+ m_webView->settings()->setViewportMetaZeroValuesQuirk(true); |
+ m_webView->settings()->setWideViewportQuirkEnabled(true); |
+ FrameTestHelpers::loadFrame(m_webView->mainFrame(), m_baseURL + "viewport-nonzero-values.html"); |
+ Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
+ m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
+ |
+ WebViewImpl* webViewImpl = toWebViewImpl(m_webView); |
+ EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewImpl->mainFrameImpl()->frameView()->fixedLayoutSize().width()); |
+ EXPECT_EQ(expectedPageScaleFactor, m_webView->pageScaleFactor()); |
+ |
+ m_webView->settings()->setUseWideViewport(true); |
+ m_webView->layout(); |
+ EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewImpl->mainFrameImpl()->frameView()->fixedLayoutSize().width()); |
+ EXPECT_EQ(expectedPageScaleFactor, m_webView->pageScaleFactor()); |
+} |
+ |
TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) |
{ |
registerMockedHttpURLLoad("scale_oscillate.html"); |