| 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 "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/html/HTMLBodyElement.h" | 11 #include "core/html/HTMLBodyElement.h" |
| 12 #include "core/html/HTMLElement.h" | 12 #include "core/html/HTMLElement.h" |
| 13 #include "core/input/EventHandler.h" | 13 #include "core/input/EventHandler.h" |
| 14 #include "core/layout/LayoutObject.h" | 14 #include "core/layout/LayoutObject.h" |
| 15 #include "core/layout/LayoutView.h" | 15 #include "core/layout/LayoutView.h" |
| 16 #include "core/layout/compositing/PaintLayerCompositor.h" | 16 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 17 #include "core/page/Page.h" | 17 #include "core/page/Page.h" |
| 18 #include "platform/PlatformGestureEvent.h" | 18 #include "platform/PlatformGestureEvent.h" |
| 19 #include "platform/geometry/DoublePoint.h" | 19 #include "platform/geometry/DoublePoint.h" |
| 20 #include "platform/geometry/DoubleRect.h" | 20 #include "platform/geometry/DoubleRect.h" |
| 21 #include "platform/testing/URLTestHelpers.h" | 21 #include "platform/testing/URLTestHelpers.h" |
| 22 #include "public/platform/Platform.h" | 22 #include "public/platform/Platform.h" |
| 23 #include "public/platform/WebLayerTreeView.h" | 23 #include "public/platform/WebLayerTreeView.h" |
| 24 #include "public/platform/WebUnitTestSupport.h" | 24 #include "public/platform/WebURLLoaderMockFactory.h" |
| 25 #include "public/web/WebCache.h" |
| 25 #include "public/web/WebContextMenuData.h" | 26 #include "public/web/WebContextMenuData.h" |
| 26 #include "public/web/WebDocument.h" | 27 #include "public/web/WebDocument.h" |
| 27 #include "public/web/WebFrameClient.h" | 28 #include "public/web/WebFrameClient.h" |
| 28 #include "public/web/WebInputEvent.h" | 29 #include "public/web/WebInputEvent.h" |
| 29 #include "public/web/WebScriptSource.h" | 30 #include "public/web/WebScriptSource.h" |
| 30 #include "public/web/WebSettings.h" | 31 #include "public/web/WebSettings.h" |
| 31 #include "public/web/WebViewClient.h" | 32 #include "public/web/WebViewClient.h" |
| 32 #include "testing/gmock/include/gmock/gmock.h" | 33 #include "testing/gmock/include/gmock/gmock.h" |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
| 34 #include "web/WebLocalFrameImpl.h" | 35 #include "web/WebLocalFrameImpl.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 void initializeWithAndroidSettings(void (*overrideSettingsFunc)(WebSettings*
) = 0) | 124 void initializeWithAndroidSettings(void (*overrideSettingsFunc)(WebSettings*
) = 0) |
| 124 { | 125 { |
| 125 if (!overrideSettingsFunc) | 126 if (!overrideSettingsFunc) |
| 126 overrideSettingsFunc = &configureAndroidSettings; | 127 overrideSettingsFunc = &configureAndroidSettings; |
| 127 m_helper.initialize(true, 0, &m_mockWebViewClient, overrideSettingsFunc)
; | 128 m_helper.initialize(true, 0, &m_mockWebViewClient, overrideSettingsFunc)
; |
| 128 webViewImpl()->setDefaultPageScaleLimits(0.25f, 5); | 129 webViewImpl()->setDefaultPageScaleLimits(0.25f, 5); |
| 129 } | 130 } |
| 130 | 131 |
| 131 ~VisualViewportTest() override | 132 ~VisualViewportTest() override |
| 132 { | 133 { |
| 133 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 134 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); |
| 135 WebCache::clear(); |
| 134 } | 136 } |
| 135 | 137 |
| 136 void navigateTo(const std::string& url) | 138 void navigateTo(const std::string& url) |
| 137 { | 139 { |
| 138 FrameTestHelpers::loadFrame(webViewImpl()->mainFrame(), url); | 140 FrameTestHelpers::loadFrame(webViewImpl()->mainFrame(), url); |
| 139 } | 141 } |
| 140 | 142 |
| 141 void forceFullCompositingUpdate() | 143 void forceFullCompositingUpdate() |
| 142 { | 144 { |
| 143 webViewImpl()->updateAllLifecyclePhases(); | 145 webViewImpl()->updateAllLifecyclePhases(); |
| (...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 webViewImpl()->handleInputEvent(pinchUpdate); | 1742 webViewImpl()->handleInputEvent(pinchUpdate); |
| 1741 | 1743 |
| 1742 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); | 1744 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); |
| 1743 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); | 1745 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
| 1744 | 1746 |
| 1745 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); | 1747 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); |
| 1746 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); | 1748 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); |
| 1747 } | 1749 } |
| 1748 | 1750 |
| 1749 } // namespace | 1751 } // namespace |
| OLD | NEW |