OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "core/html/HTMLIFrameElement.h" | 32 #include "core/html/HTMLIFrameElement.h" |
33 #include "core/layout/LayoutPart.h" | 33 #include "core/layout/LayoutPart.h" |
34 #include "core/layout/api/LayoutViewItem.h" | 34 #include "core/layout/api/LayoutViewItem.h" |
35 #include "core/layout/compositing/CompositedLayerMapping.h" | 35 #include "core/layout/compositing/CompositedLayerMapping.h" |
36 #include "core/layout/compositing/PaintLayerCompositor.h" | 36 #include "core/layout/compositing/PaintLayerCompositor.h" |
37 #include "core/page/Page.h" | 37 #include "core/page/Page.h" |
38 #include "platform/geometry/IntPoint.h" | 38 #include "platform/geometry/IntPoint.h" |
39 #include "platform/geometry/IntRect.h" | 39 #include "platform/geometry/IntRect.h" |
40 #include "platform/graphics/GraphicsLayer.h" | 40 #include "platform/graphics/GraphicsLayer.h" |
41 #include "platform/testing/URLTestHelpers.h" | 41 #include "platform/testing/URLTestHelpers.h" |
| 42 #include "platform/testing/UnitTestHelpers.h" |
42 #include "public/platform/Platform.h" | 43 #include "public/platform/Platform.h" |
43 #include "public/platform/WebLayer.h" | 44 #include "public/platform/WebLayer.h" |
44 #include "public/platform/WebLayerPositionConstraint.h" | 45 #include "public/platform/WebLayerPositionConstraint.h" |
45 #include "public/platform/WebLayerTreeView.h" | 46 #include "public/platform/WebLayerTreeView.h" |
46 #include "public/platform/WebURLLoaderMockFactory.h" | 47 #include "public/platform/WebURLLoaderMockFactory.h" |
47 #include "public/web/WebCache.h" | 48 #include "public/web/WebCache.h" |
48 #include "public/web/WebSettings.h" | 49 #include "public/web/WebSettings.h" |
49 #include "public/web/WebViewClient.h" | 50 #include "public/web/WebViewClient.h" |
50 #include "testing/gtest/include/gtest/gtest.h" | 51 #include "testing/gtest/include/gtest/gtest.h" |
51 #include "web/WebLocalFrameImpl.h" | 52 #include "web/WebLocalFrameImpl.h" |
52 #include "web/WebViewImpl.h" | 53 #include "web/WebViewImpl.h" |
53 #include "web/tests/FrameTestHelpers.h" | 54 #include "web/tests/FrameTestHelpers.h" |
54 | 55 |
55 namespace blink { | 56 namespace blink { |
56 | 57 |
57 class ScrollingCoordinatorTest : public testing::Test { | 58 class ScrollingCoordinatorTest : public ::testing::Test { |
58 public: | 59 public: |
59 ScrollingCoordinatorTest() : m_baseURL("http://www.test.com/") { | 60 ScrollingCoordinatorTest() : m_baseURL("http://www.test.com/") { |
60 m_helper.initialize(true, nullptr, &m_mockWebViewClient, nullptr, | 61 m_helper.initialize(true, nullptr, &m_mockWebViewClient, nullptr, |
61 &configureSettings); | 62 &configureSettings); |
62 webViewImpl()->resize(IntSize(320, 240)); | 63 webViewImpl()->resize(IntSize(320, 240)); |
63 | 64 |
64 // macOS attaches main frame scrollbars to the VisualViewport so the | 65 // macOS attaches main frame scrollbars to the VisualViewport so the |
65 // VisualViewport layers need to be initialized. | 66 // VisualViewport layers need to be initialized. |
66 webViewImpl()->updateAllLifecyclePhases(); | 67 webViewImpl()->updateAllLifecyclePhases(); |
67 WebFrameWidgetBase* mainFrameWidget = | 68 WebFrameWidgetBase* mainFrameWidget = |
(...skipping 14 matching lines...) Expand all Loading... |
82 | 83 |
83 void navigateTo(const std::string& url) { | 84 void navigateTo(const std::string& url) { |
84 FrameTestHelpers::loadFrame(webViewImpl()->mainFrame(), url); | 85 FrameTestHelpers::loadFrame(webViewImpl()->mainFrame(), url); |
85 } | 86 } |
86 | 87 |
87 void forceFullCompositingUpdate() { | 88 void forceFullCompositingUpdate() { |
88 webViewImpl()->updateAllLifecyclePhases(); | 89 webViewImpl()->updateAllLifecyclePhases(); |
89 } | 90 } |
90 | 91 |
91 void registerMockedHttpURLLoad(const std::string& fileName) { | 92 void registerMockedHttpURLLoad(const std::string& fileName) { |
92 URLTestHelpers::registerMockedURLFromBaseURL( | 93 URLTestHelpers::registerMockedURLLoadFromBase( |
93 WebString::fromUTF8(m_baseURL.c_str()), | 94 WebString::fromUTF8(m_baseURL), testing::webTestDataPath(), |
94 WebString::fromUTF8(fileName.c_str())); | 95 WebString::fromUTF8(fileName)); |
95 } | 96 } |
96 | 97 |
97 WebLayer* getRootScrollLayer() { | 98 WebLayer* getRootScrollLayer() { |
98 PaintLayerCompositor* compositor = | 99 PaintLayerCompositor* compositor = |
99 frame()->contentLayoutItem().compositor(); | 100 frame()->contentLayoutItem().compositor(); |
100 DCHECK(compositor); | 101 DCHECK(compositor); |
101 DCHECK(compositor->scrollLayer()); | 102 DCHECK(compositor->scrollLayer()); |
102 | 103 |
103 WebLayer* webScrollLayer = compositor->scrollLayer()->platformLayer(); | 104 WebLayer* webScrollLayer = compositor->scrollLayer()->platformLayer(); |
104 return webScrollLayer; | 105 return webScrollLayer; |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 MainThreadScrollingReason::kHasOpacityAndLCDText | | 1154 MainThreadScrollingReason::kHasOpacityAndLCDText | |
1154 MainThreadScrollingReason::kHasBorderRadius); | 1155 MainThreadScrollingReason::kHasBorderRadius); |
1155 } | 1156 } |
1156 | 1157 |
1157 TEST_F(StyleRelatedMainThreadScrollingReasonTest, BoxShadowTest) { | 1158 TEST_F(StyleRelatedMainThreadScrollingReasonTest, BoxShadowTest) { |
1158 testStyle("box-shadow", | 1159 testStyle("box-shadow", |
1159 MainThreadScrollingReason::kHasBoxShadowFromNonRootLayer); | 1160 MainThreadScrollingReason::kHasBoxShadowFromNonRootLayer); |
1160 } | 1161 } |
1161 | 1162 |
1162 } // namespace blink | 1163 } // namespace blink |
OLD | NEW |