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

Side by Side Diff: Source/web/tests/WebFrameTest.cpp

Issue 61593006: Zoom instead of autosizing for desktop sites. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add a test. Created 7 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 EXPECT_EQ(1.0f, webViewHelper.webView()->minimumPageScaleFactor()); 2081 EXPECT_EQ(1.0f, webViewHelper.webView()->minimumPageScaleFactor());
2082 EXPECT_EQ(5.0f, webViewHelper.webView()->maximumPageScaleFactor()); 2082 EXPECT_EQ(5.0f, webViewHelper.webView()->maximumPageScaleFactor());
2083 2083
2084 webViewHelper.webView()->setIgnoreViewportTagScaleLimits(false); 2084 webViewHelper.webView()->setIgnoreViewportTagScaleLimits(false);
2085 webViewHelper.webView()->layout(); 2085 webViewHelper.webView()->layout();
2086 2086
2087 EXPECT_EQ(2.0f, webViewHelper.webView()->minimumPageScaleFactor()); 2087 EXPECT_EQ(2.0f, webViewHelper.webView()->minimumPageScaleFactor());
2088 EXPECT_EQ(2.0f, webViewHelper.webView()->maximumPageScaleFactor()); 2088 EXPECT_EQ(2.0f, webViewHelper.webView()->maximumPageScaleFactor());
2089 } 2089 }
2090 2090
2091 TEST_F(WebFrameTest, DeviceScaleAdjustmentReducesLayoutWidth)
2092 {
2093 UseMockScrollbarSettings mockScrollbarSettings;
2094
2095 registerMockedHttpURLLoad("hello_world.html");
2096
2097 int viewportWidth = 1280;
2098 int viewportHeight = 800;
2099 float deviceScaleAdjustment = 1.3f;
2100
2101 FrameTestHelpers::WebViewHelper webViewHelper;
2102 webViewHelper.initializeAndLoad(m_baseURL + "hello_world.html", true);
2103 webViewHelper.webView()->settings()->setViewportEnabled(true);
2104 webViewHelper.webView()->settings()->setDeviceScaleAdjustment(deviceScaleAdj ustment);
2105
2106 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight));
2107 webViewHelper.webView()->layout();
2108
2109 EXPECT_EQ(static_cast<int>(viewportWidth / deviceScaleAdjustment),
2110 webViewHelper.webViewImpl()->page()->mainFrame()->view()->layoutSize().w idth());
2111 }
2112
2091 TEST_F(WebFrameTest, updateOverlayScrollbarLayers) 2113 TEST_F(WebFrameTest, updateOverlayScrollbarLayers)
2092 { 2114 {
2093 UseMockScrollbarSettings mockScrollbarSettings; 2115 UseMockScrollbarSettings mockScrollbarSettings;
2094 2116
2095 registerMockedHttpURLLoad("large-div.html"); 2117 registerMockedHttpURLLoad("large-div.html");
2096 2118
2097 int viewWidth = 500; 2119 int viewWidth = 500;
2098 int viewHeight = 500; 2120 int viewHeight = 500;
2099 2121
2100 OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr (new FakeCompositingWebViewClient()); 2122 OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr (new FakeCompositingWebViewClient());
(...skipping 2793 matching lines...) Expand 10 before | Expand all | Expand 10 after
4894 4916
4895 FrameTestHelpers::loadFrame(frame, 4917 FrameTestHelpers::loadFrame(frame,
4896 "javascript:window.frames[1].location.assign('" + m_baseURL + "find.html ')"); 4918 "javascript:window.frames[1].location.assign('" + m_baseURL + "find.html ')");
4897 runPendingTasks(); 4919 runPendingTasks();
4898 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 4920 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
4899 EXPECT_EQ(client.frame(), iframe); 4921 EXPECT_EQ(client.frame(), iframe);
4900 EXPECT_FALSE(client.replacesCurrentHistoryItem()); 4922 EXPECT_FALSE(client.replacesCurrentHistoryItem());
4901 } 4923 }
4902 4924
4903 } // namespace 4925 } // namespace
OLDNEW
« Source/web/PageScaleConstraintsSet.cpp ('K') | « Source/web/WebViewImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698