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

Side by Side Diff: third_party/WebKit/Source/web/tests/VisualViewportTest.cpp

Issue 2258523006: Convert Settings::rootLayerScrolls to RuntimeEnabledFeatures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add RAII-style helper to toggle REF. Rebase. Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/VisualViewport.h" 5 #include "core/frame/VisualViewport.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/FrameHost.h" 8 #include "core/frame/FrameHost.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
11 #include "core/frame/TopControls.h" 11 #include "core/frame/TopControls.h"
12 #include "core/html/HTMLBodyElement.h" 12 #include "core/html/HTMLBodyElement.h"
13 #include "core/html/HTMLElement.h" 13 #include "core/html/HTMLElement.h"
14 #include "core/input/EventHandler.h" 14 #include "core/input/EventHandler.h"
15 #include "core/layout/LayoutObject.h" 15 #include "core/layout/LayoutObject.h"
16 #include "core/layout/api/LayoutViewItem.h" 16 #include "core/layout/api/LayoutViewItem.h"
17 #include "core/layout/compositing/PaintLayerCompositor.h" 17 #include "core/layout/compositing/PaintLayerCompositor.h"
18 #include "core/page/Page.h" 18 #include "core/page/Page.h"
19 #include "platform/PlatformGestureEvent.h" 19 #include "platform/PlatformGestureEvent.h"
20 #include "platform/geometry/DoublePoint.h" 20 #include "platform/geometry/DoublePoint.h"
21 #include "platform/geometry/DoubleRect.h" 21 #include "platform/geometry/DoubleRect.h"
22 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
22 #include "platform/testing/URLTestHelpers.h" 23 #include "platform/testing/URLTestHelpers.h"
23 #include "public/platform/Platform.h" 24 #include "public/platform/Platform.h"
24 #include "public/platform/WebCachePolicy.h" 25 #include "public/platform/WebCachePolicy.h"
25 #include "public/platform/WebLayerTreeView.h" 26 #include "public/platform/WebLayerTreeView.h"
26 #include "public/platform/WebURLLoaderMockFactory.h" 27 #include "public/platform/WebURLLoaderMockFactory.h"
27 #include "public/web/WebCache.h" 28 #include "public/web/WebCache.h"
28 #include "public/web/WebContextMenuData.h" 29 #include "public/web/WebContextMenuData.h"
29 #include "public/web/WebDocument.h" 30 #include "public/web/WebDocument.h"
30 #include "public/web/WebFrameClient.h" 31 #include "public/web/WebFrameClient.h"
31 #include "public/web/WebInputEvent.h" 32 #include "public/web/WebInputEvent.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 { 96 {
96 return os << "Context menu location: [" 97 return os << "Context menu location: ["
97 << data.mousePosition.x << ", " << data.mousePosition.y << "]"; 98 << data.mousePosition.x << ", " << data.mousePosition.y << "]";
98 } 99 }
99 } 100 }
100 101
101 102
102 namespace { 103 namespace {
103 104
104 class VisualViewportTest 105 class VisualViewportTest
105 : public testing::Test 106 : public testing::Test {
106 , public FrameTestHelpers::SettingOverrider {
107 public: 107 public:
108 VisualViewportTest() 108 VisualViewportTest()
109 : m_baseURL("http://www.test.com/") 109 : m_baseURL("http://www.test.com/")
110 , m_helper(this)
111 { 110 {
112 } 111 }
113 112
114 void overrideSettings(WebSettings *settings) override
115 {
116 }
117
118 void initializeWithDesktopSettings(void (*overrideSettingsFunc)(WebSettings* ) = 0) 113 void initializeWithDesktopSettings(void (*overrideSettingsFunc)(WebSettings* ) = 0)
119 { 114 {
120 if (!overrideSettingsFunc) 115 if (!overrideSettingsFunc)
121 overrideSettingsFunc = &configureSettings; 116 overrideSettingsFunc = &configureSettings;
122 m_helper.initialize(true, nullptr, &m_mockWebViewClient, nullptr, overri deSettingsFunc); 117 m_helper.initialize(true, nullptr, &m_mockWebViewClient, nullptr, overri deSettingsFunc);
123 webViewImpl()->setDefaultPageScaleLimits(1, 4); 118 webViewImpl()->setDefaultPageScaleLimits(1, 4);
124 } 119 }
125 120
126 void initializeWithAndroidSettings(void (*overrideSettingsFunc)(WebSettings* ) = 0) 121 void initializeWithAndroidSettings(void (*overrideSettingsFunc)(WebSettings* ) = 0)
127 { 122 {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 176 }
182 177
183 protected: 178 protected:
184 std::string m_baseURL; 179 std::string m_baseURL;
185 FrameTestHelpers::TestWebViewClient m_mockWebViewClient; 180 FrameTestHelpers::TestWebViewClient m_mockWebViewClient;
186 181
187 private: 182 private:
188 FrameTestHelpers::WebViewHelper m_helper; 183 FrameTestHelpers::WebViewHelper m_helper;
189 }; 184 };
190 185
186 typedef bool TestParamRootLayerScrolling;
191 class ParameterizedVisualViewportTest 187 class ParameterizedVisualViewportTest
192 : public VisualViewportTest 188 : public testing::WithParamInterface<TestParamRootLayerScrolling>
193 , public testing::WithParamInterface<FrameTestHelpers::SettingOverrideFuncti on> { 189 , private ScopedRootLayerScrollingForTest
190 , public VisualViewportTest {
194 public: 191 public:
195 void overrideSettings(WebSettings *settings) override 192 ParameterizedVisualViewportTest()
196 { 193 : ScopedRootLayerScrollingForTest(GetParam()) { }
197 GetParam()(settings);
198 }
199 }; 194 };
200 195
201 INSTANTIATE_TEST_CASE_P(All, ParameterizedVisualViewportTest, ::testing::Values( 196 INSTANTIATE_TEST_CASE_P(All, ParameterizedVisualViewportTest, ::testing::Bool()) ;
202 FrameTestHelpers::DefaultSettingOverride,
203 FrameTestHelpers::RootLayerScrollsSettingOverride));
204 197
205 // Test that resizing the VisualViewport works as expected and that resizing the 198 // Test that resizing the VisualViewport works as expected and that resizing the
206 // WebView resizes the VisualViewport. 199 // WebView resizes the VisualViewport.
207 TEST_P(ParameterizedVisualViewportTest, TestResize) 200 TEST_P(ParameterizedVisualViewportTest, TestResize)
208 { 201 {
209 initializeWithDesktopSettings(); 202 initializeWithDesktopSettings();
210 webViewImpl()->resize(IntSize(320, 240)); 203 webViewImpl()->resize(IntSize(320, 240));
211 204
212 navigateTo("about:blank"); 205 navigateTo("about:blank");
213 forceFullCompositingUpdate(); 206 forceFullCompositingUpdate();
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 1918
1926 EXPECT_POINT_EQ( 1919 EXPECT_POINT_EQ(
1927 DoublePoint(), 1920 DoublePoint(),
1928 frameView.layoutViewportScrollableArea()->scrollPositionDouble()); 1921 frameView.layoutViewportScrollableArea()->scrollPositionDouble());
1929 EXPECT_EQ(600, scroller->scrollTop()); 1922 EXPECT_EQ(600, scroller->scrollTop());
1930 1923
1931 RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled); 1924 RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled);
1932 } 1925 }
1933 1926
1934 } // namespace 1927 } // namespace
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698