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/frame/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 EXPECT_SIZE_EQ(webViewSize, IntSize(webViewImpl()->size())); | 188 EXPECT_SIZE_EQ(webViewSize, IntSize(webViewImpl()->size())); |
189 EXPECT_SIZE_EQ(webViewSize, pinchViewport.size()); | 189 EXPECT_SIZE_EQ(webViewSize, pinchViewport.size()); |
190 | 190 |
191 // Resizing the pinch viewport shouldn't affect the WebView. | 191 // Resizing the pinch viewport shouldn't affect the WebView. |
192 IntSize newViewportSize = IntSize(320, 200); | 192 IntSize newViewportSize = IntSize(320, 200); |
193 pinchViewport.setSize(newViewportSize); | 193 pinchViewport.setSize(newViewportSize); |
194 EXPECT_SIZE_EQ(webViewSize, IntSize(webViewImpl()->size())); | 194 EXPECT_SIZE_EQ(webViewSize, IntSize(webViewImpl()->size())); |
195 EXPECT_SIZE_EQ(newViewportSize, pinchViewport.size()); | 195 EXPECT_SIZE_EQ(newViewportSize, pinchViewport.size()); |
196 } | 196 } |
197 | 197 |
198 static void turnOffForceCompositingMode(WebSettings* settings) | 198 static void disableAcceleratedCompositing(WebSettings* settings) |
199 { | 199 { |
200 PinchViewportTest::configureSettings(settings); | 200 PinchViewportTest::configureSettings(settings); |
201 // FIXME: This setting is being removed, so this test needs to be rewritten
to | 201 // FIXME: This setting is being removed, so this test needs to be rewritten
to |
202 // do something else. crbug.com/173949 | 202 // do something else. crbug.com/173949 |
203 settings->setAcceleratedCompositingEnabled(false); | 203 settings->setAcceleratedCompositingEnabled(false); |
204 } | 204 } |
205 | 205 |
206 // Test that the container layer gets sized properly if the WebView is resized | 206 // Test that the container layer gets sized properly if the WebView is resized |
207 // prior to the PinchViewport being attached to the layer tree. | 207 // prior to the PinchViewport being attached to the layer tree. |
208 TEST_F(PinchViewportTest, TestWebViewResizedBeforeAttachment) | 208 TEST_F(PinchViewportTest, TestWebViewResizedBeforeAttachment) |
209 { | 209 { |
210 initializeWithDesktopSettings(turnOffForceCompositingMode); | 210 initializeWithDesktopSettings(disableAcceleratedCompositing); |
211 webViewImpl()->resize(IntSize(320, 240)); | 211 webViewImpl()->resize(IntSize(320, 240)); |
212 | 212 |
213 navigateTo("about:blank"); | 213 navigateTo("about:blank"); |
214 forceFullCompositingUpdate(); | 214 forceFullCompositingUpdate(); |
215 webViewImpl()->settings()->setAcceleratedCompositingEnabled(true); | 215 webViewImpl()->settings()->setAcceleratedCompositingEnabled(true); |
216 webViewImpl()->layout(); | 216 webViewImpl()->layout(); |
217 | 217 |
218 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); | 218 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); |
219 EXPECT_FLOAT_SIZE_EQ(FloatSize(320, 240), pinchViewport.containerLayer()->si
ze()); | 219 EXPECT_FLOAT_SIZE_EQ(FloatSize(320, 240), pinchViewport.containerLayer()->si
ze()); |
220 } | 220 } |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 pinchViewport.scrollIntoView(FloatRect(50, 75, 50, 75)); | 795 pinchViewport.scrollIntoView(FloatRect(50, 75, 50, 75)); |
796 EXPECT_POINT_EQ(IntPoint(50, 75), frame()->view()->scrollPosition()); | 796 EXPECT_POINT_EQ(IntPoint(50, 75), frame()->view()->scrollPosition()); |
797 EXPECT_FLOAT_POINT_EQ(FloatPoint(), pinchViewport.visibleRect().location()); | 797 EXPECT_FLOAT_POINT_EQ(FloatPoint(), pinchViewport.visibleRect().location()); |
798 | 798 |
799 pinchViewport.scrollIntoView(FloatRect(190, 290, 10, 10)); | 799 pinchViewport.scrollIntoView(FloatRect(190, 290, 10, 10)); |
800 EXPECT_POINT_EQ(IntPoint(100, 150), frame()->view()->scrollPosition()); | 800 EXPECT_POINT_EQ(IntPoint(100, 150), frame()->view()->scrollPosition()); |
801 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 75), pinchViewport.visibleRect().locati
on()); | 801 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 75), pinchViewport.visibleRect().locati
on()); |
802 } | 802 } |
803 | 803 |
804 } // namespace | 804 } // namespace |
OLD | NEW |