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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 23754026: Properly check for a zero-valued floating-point viewport argument (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test page Created 7 years, 3 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
« no previous file with comments | « Source/core/dom/ViewportArguments.cpp ('k') | Source/web/tests/data/viewport-nonzero-values.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
« no previous file with comments | « Source/core/dom/ViewportArguments.cpp ('k') | Source/web/tests/data/viewport-nonzero-values.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698