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

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

Issue 1930363002: Avoid clobbering state in viewport tag initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review comments Created 4 years, 7 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 | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index b955561496e1a1fc1f40f8a606015b3fd8332391..e8789e0fd21ef667369ca076d72afc2b2986ff1c 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -1520,6 +1520,34 @@ TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeight)
EXPECT_LE(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height());
}
+TEST_F(WebFrameTest, ToggleViewportMetaOnOff)
+{
+ registerMockedHttpURLLoad("viewport-device-width.html");
+
+ FixedLayoutTestWebViewClient client;
+ client.m_screenInfo.deviceScaleFactor = 1;
+ int viewportWidth = 640;
+ int viewportHeight = 480;
+
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ webViewHelper.initializeAndLoad(m_baseURL + "viewport-device-width.html", true, 0, &client);
+ WebSettings* settings = webViewHelper.webView()->settings();
+ settings->setViewportMetaEnabled(false);
+ settings->setViewportEnabled(true);
+ settings->setMainFrameResizesAreOrientationChanges(true);
+ settings->setShrinksViewportContentToFit(true);
+ webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
+
+ Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->document();
+ EXPECT_FALSE(document->viewportDescription().isLegacyViewportType());
+
+ settings->setViewportMetaEnabled(true);
+ EXPECT_TRUE(document->viewportDescription().isLegacyViewportType());
+
+ settings->setViewportMetaEnabled(false);
+ EXPECT_FALSE(document->viewportDescription().isLegacyViewportType());
+}
+
TEST_F(WebFrameTest, SetForceZeroLayoutHeightWorksWithRelayoutsWhenHeightChanged)
{
// this unit test is an attempt to target a real world case where an app could
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698