| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // Resizing the pinch viewport shouldn't affect the WebView. | 192 // Resizing the pinch viewport shouldn't affect the WebView. |
| 193 IntSize newViewportSize = IntSize(320, 200); | 193 IntSize newViewportSize = IntSize(320, 200); |
| 194 pinchViewport.setSize(newViewportSize); | 194 pinchViewport.setSize(newViewportSize); |
| 195 EXPECT_SIZE_EQ(webViewSize, IntSize(webViewImpl()->size())); | 195 EXPECT_SIZE_EQ(webViewSize, IntSize(webViewImpl()->size())); |
| 196 EXPECT_SIZE_EQ(newViewportSize, pinchViewport.size()); | 196 EXPECT_SIZE_EQ(newViewportSize, pinchViewport.size()); |
| 197 } | 197 } |
| 198 | 198 |
| 199 static void turnOffForceCompositingMode(WebSettings* settings) | 199 static void turnOffForceCompositingMode(WebSettings* settings) |
| 200 { | 200 { |
| 201 PinchViewportTest::configureSettings(settings); | 201 PinchViewportTest::configureSettings(settings); |
| 202 settings->setForceCompositingMode(false); | 202 // FIXME: This setting is being removed, so this test needs to be rewritten
to |
| 203 // do something else. crbug.com/173949 |
| 204 settings->setAcceleratedCompositingEnabled(false); |
| 203 } | 205 } |
| 204 | 206 |
| 205 // Test that the container layer gets sized properly if the WebView is resized | 207 // Test that the container layer gets sized properly if the WebView is resized |
| 206 // prior to the PinchViewport being attached to the layer tree. | 208 // prior to the PinchViewport being attached to the layer tree. |
| 207 TEST_F(PinchViewportTest, TestWebViewResizedBeforeAttachment) | 209 TEST_F(PinchViewportTest, TestWebViewResizedBeforeAttachment) |
| 208 { | 210 { |
| 209 initializeWithDesktopSettings(turnOffForceCompositingMode); | 211 initializeWithDesktopSettings(turnOffForceCompositingMode); |
| 210 webViewImpl()->resize(IntSize(320, 240)); | 212 webViewImpl()->resize(IntSize(320, 240)); |
| 211 | 213 |
| 212 navigateTo("about:blank"); | 214 navigateTo("about:blank"); |
| 213 forceFullCompositingUpdate(); | 215 forceFullCompositingUpdate(); |
| 214 webViewImpl()->enterForceCompositingMode(true); | 216 webViewImpl()->settings()->setAcceleratedCompositingEnabled(true); |
| 217 webViewImpl()->layout(); |
| 215 | 218 |
| 216 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); | 219 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); |
| 217 EXPECT_FLOAT_SIZE_EQ(FloatSize(320, 240), pinchViewport.rootGraphicsLayer()-
>size()); | 220 EXPECT_FLOAT_SIZE_EQ(FloatSize(320, 240), pinchViewport.rootGraphicsLayer()-
>size()); |
| 218 } | 221 } |
| 219 | |
| 220 // Make sure that the visibleRect method acurately reflects the scale and scroll
location | 222 // Make sure that the visibleRect method acurately reflects the scale and scroll
location |
| 221 // of the viewport. | 223 // of the viewport. |
| 222 TEST_F(PinchViewportTest, TestVisibleRect) | 224 TEST_F(PinchViewportTest, TestVisibleRect) |
| 223 { | 225 { |
| 224 initializeWithDesktopSettings(); | 226 initializeWithDesktopSettings(); |
| 225 webViewImpl()->resize(IntSize(320, 240)); | 227 webViewImpl()->resize(IntSize(320, 240)); |
| 226 | 228 |
| 227 navigateTo("about:blank"); | 229 navigateTo("about:blank"); |
| 228 forceFullCompositingUpdate(); | 230 forceFullCompositingUpdate(); |
| 229 | 231 |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 | 721 |
| 720 mouseDownEvent.button = WebMouseEvent::ButtonRight; | 722 mouseDownEvent.button = WebMouseEvent::ButtonRight; |
| 721 webViewImpl()->handleInputEvent(mouseDownEvent); | 723 webViewImpl()->handleInputEvent(mouseDownEvent); |
| 722 webViewImpl()->handleInputEvent(mouseUpEvent); | 724 webViewImpl()->handleInputEvent(mouseUpEvent); |
| 723 | 725 |
| 724 // Reset the old client so destruction can occur naturally. | 726 // Reset the old client so destruction can occur naturally. |
| 725 webViewImpl()->mainFrameImpl()->setClient(oldClient); | 727 webViewImpl()->mainFrameImpl()->setClient(oldClient); |
| 726 } | 728 } |
| 727 | 729 |
| 728 } // namespace | 730 } // namespace |
| OLD | NEW |