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

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

Issue 23459006: [Android WebView] Fix WideViewport use case after r157293 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added a test for useWideViewport=false + <meta name='viewport' content='height=1000'> 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/page/PageScaleConstraintsSet.cpp ('k') | Source/web/tests/data/viewport-height-1000.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 bae3cc9b1416685e1864e12981784ed8eeabcd1a..484e984c81d50af82e518e71c691b7aaf1ac2e34 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -581,6 +581,45 @@ TEST_F(WebFrameTest, NoWideViewportIgnoresPageViewportWidthButAccountsScale)
EXPECT_EQ(viewportHeight / 2, webViewImpl()->mainFrameImpl()->frameView()->contentsSize().height());
}
+TEST_F(WebFrameTest, WideViewportSetsTo980WithoutViewportTag)
+{
+ registerMockedHttpURLLoad("no_viewport_tag.html");
+
+ FixedLayoutTestWebViewClient client;
+ client.m_screenInfo.deviceScaleFactor = 1;
+ int viewportWidth = 640;
+ int viewportHeight = 480;
+
+ m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client);
+ m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true);
+ m_webView->enableFixedLayoutMode(true);
+ m_webView->settings()->setUseWideViewport(true);
+ m_webView->settings()->setViewportEnabled(true);
+ m_webView->resize(WebSize(viewportWidth, viewportHeight));
+
+ EXPECT_EQ(980, webViewImpl()->mainFrameImpl()->frameView()->contentsSize().width());
+ EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewImpl()->mainFrameImpl()->frameView()->contentsSize().height());
+}
+
+TEST_F(WebFrameTest, NoWideViewportAndHeightInMeta)
+{
+ registerMockedHttpURLLoad("viewport-height-1000.html");
+
+ FixedLayoutTestWebViewClient client;
+ client.m_screenInfo.deviceScaleFactor = 1;
+ int viewportWidth = 640;
+ int viewportHeight = 480;
+
+ m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-height-1000.html", true, 0, &client);
+ m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true);
+ m_webView->enableFixedLayoutMode(true);
+ m_webView->settings()->setUseWideViewport(false);
+ m_webView->settings()->setViewportEnabled(true);
+ m_webView->resize(WebSize(viewportWidth, viewportHeight));
+
+ EXPECT_EQ(viewportWidth, webViewImpl()->mainFrameImpl()->frameView()->contentsSize().width());
+}
+
TEST_F(WebFrameTest, WideViewportSetsTo980WithAutoWidth)
{
registerMockedHttpURLLoad("viewport-2x-initial-scale.html");
« no previous file with comments | « Source/core/page/PageScaleConstraintsSet.cpp ('k') | Source/web/tests/data/viewport-height-1000.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698