| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "core/frame/PinchViewport.h" | 7 #include "core/frame/PinchViewport.h" |
| 8 | 8 |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/frame/FrameHost.h" | 10 #include "core/frame/FrameHost.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // scrollbar themes. | 191 // scrollbar themes. |
| 192 FrameTestHelpers::UseMockScrollbarSettings m_useMockScrollbars; | 192 FrameTestHelpers::UseMockScrollbarSettings m_useMockScrollbars; |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 typedef void (*SettingOverrideFunction)(WebSettings*); | 195 typedef void (*SettingOverrideFunction)(WebSettings*); |
| 196 | 196 |
| 197 static void DefaultSettingOverride(WebSettings *) | 197 static void DefaultSettingOverride(WebSettings *) |
| 198 { | 198 { |
| 199 } | 199 } |
| 200 | 200 |
| 201 static void RootLayerScrollsSettingOverride(WebSettings *settings) | |
| 202 { | |
| 203 settings->setRootLayerScrolls(true); | |
| 204 } | |
| 205 | |
| 206 class ParameterizedPinchViewportTest | 201 class ParameterizedPinchViewportTest |
| 207 : public PinchViewportTest | 202 : public PinchViewportTest |
| 208 , public testing::WithParamInterface<SettingOverrideFunction> { | 203 , public testing::WithParamInterface<SettingOverrideFunction> { |
| 209 public: | 204 public: |
| 210 void overrideSettings(WebSettings *settings) override | 205 void overrideSettings(WebSettings *settings) override |
| 211 { | 206 { |
| 212 GetParam()(settings); | 207 GetParam()(settings); |
| 213 } | 208 } |
| 214 }; | 209 }; |
| 215 | 210 |
| 211 #if OS(MACOSX) && ENABLE(OILPAN) |
| 212 // FIXME(504655): RootLayerScrolls configuration crashes on Mac Oilpan bots. |
| 213 INSTANTIATE_TEST_CASE_P(All, ParameterizedPinchViewportTest, ::testing::Values( |
| 214 DefaultSettingOverride)); |
| 215 #else |
| 216 static void RootLayerScrollsSettingOverride(WebSettings *settings) |
| 217 { |
| 218 settings->setRootLayerScrolls(true); |
| 219 } |
| 216 INSTANTIATE_TEST_CASE_P(All, ParameterizedPinchViewportTest, ::testing::Values( | 220 INSTANTIATE_TEST_CASE_P(All, ParameterizedPinchViewportTest, ::testing::Values( |
| 217 DefaultSettingOverride, | 221 DefaultSettingOverride, |
| 218 RootLayerScrollsSettingOverride)); | 222 RootLayerScrollsSettingOverride)); |
| 223 #endif |
| 219 | 224 |
| 220 // Test that resizing the PinchViewport works as expected and that resizing the | 225 // Test that resizing the PinchViewport works as expected and that resizing the |
| 221 // WebView resizes the PinchViewport. | 226 // WebView resizes the PinchViewport. |
| 222 TEST_P(ParameterizedPinchViewportTest, TestResize) | 227 TEST_P(ParameterizedPinchViewportTest, TestResize) |
| 223 { | 228 { |
| 224 initializeWithDesktopSettings(); | 229 initializeWithDesktopSettings(); |
| 225 webViewImpl()->resize(IntSize(320, 240)); | 230 webViewImpl()->resize(IntSize(320, 240)); |
| 226 | 231 |
| 227 navigateTo("about:blank"); | 232 navigateTo("about:blank"); |
| 228 forceFullCompositingUpdate(); | 233 forceFullCompositingUpdate(); |
| (...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1747 webViewImpl()->handleInputEvent(pinchUpdate); | 1752 webViewImpl()->handleInputEvent(pinchUpdate); |
| 1748 | 1753 |
| 1749 PinchViewport& pinchViewport = webViewImpl()->page()->frameHost().pinchViewp
ort(); | 1754 PinchViewport& pinchViewport = webViewImpl()->page()->frameHost().pinchViewp
ort(); |
| 1750 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); | 1755 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
| 1751 | 1756 |
| 1752 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), pinchViewport.location()); | 1757 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), pinchViewport.location()); |
| 1753 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); | 1758 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); |
| 1754 } | 1759 } |
| 1755 | 1760 |
| 1756 } // namespace | 1761 } // namespace |
| OLD | NEW |