OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <gtest/gtest.h> | |
Takashi Toyoshima
2017/02/06 09:13:42
hum.... this should not be a system header!
| |
6 #include <memory> | |
5 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
6 #include "core/layout/api/LayoutViewItem.h" | 8 #include "core/layout/api/LayoutViewItem.h" |
7 #include "core/layout/compositing/CompositedLayerMapping.h" | 9 #include "core/layout/compositing/CompositedLayerMapping.h" |
8 #include "core/layout/compositing/PaintLayerCompositor.h" | 10 #include "core/layout/compositing/PaintLayerCompositor.h" |
9 #include "core/page/Page.h" | 11 #include "core/page/Page.h" |
10 #include "platform/graphics/CompositorMutableProperties.h" | 12 #include "platform/graphics/CompositorMutableProperties.h" |
11 #include "platform/graphics/CompositorMutation.h" | 13 #include "platform/graphics/CompositorMutation.h" |
12 #include "platform/graphics/GraphicsLayer.h" | 14 #include "platform/graphics/GraphicsLayer.h" |
13 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 15 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
14 #include "platform/testing/URLTestHelpers.h" | 16 #include "platform/testing/URLTestHelpers.h" |
17 #include "platform/testing/UnitTestHelpers.h" | |
15 #include "public/platform/Platform.h" | 18 #include "public/platform/Platform.h" |
16 #include "public/platform/WebLayer.h" | 19 #include "public/platform/WebLayer.h" |
17 #include "public/platform/WebLayerTreeView.h" | 20 #include "public/platform/WebLayerTreeView.h" |
18 #include "public/platform/WebURLLoaderMockFactory.h" | 21 #include "public/platform/WebURLLoaderMockFactory.h" |
19 #include "public/web/WebCache.h" | 22 #include "public/web/WebCache.h" |
20 #include "public/web/WebSettings.h" | 23 #include "public/web/WebSettings.h" |
21 #include "public/web/WebViewClient.h" | 24 #include "public/web/WebViewClient.h" |
22 #include "web/WebLocalFrameImpl.h" | 25 #include "web/WebLocalFrameImpl.h" |
23 #include "web/WebViewImpl.h" | 26 #include "web/WebViewImpl.h" |
24 #include "web/tests/FrameTestHelpers.h" | 27 #include "web/tests/FrameTestHelpers.h" |
25 #include "wtf/PtrUtil.h" | 28 #include "wtf/PtrUtil.h" |
26 #include <gtest/gtest.h> | |
27 #include <memory> | |
28 | 29 |
29 namespace blink { | 30 namespace blink { |
30 | 31 |
31 typedef bool TestParamRootLayerScrolling; | 32 typedef bool TestParamRootLayerScrolling; |
32 class CompositorWorkerTest | 33 class CompositorWorkerTest |
33 : public testing::WithParamInterface<TestParamRootLayerScrolling>, | 34 : public ::testing::WithParamInterface<TestParamRootLayerScrolling>, |
34 private ScopedRootLayerScrollingForTest, | 35 private ScopedRootLayerScrollingForTest, |
35 private ScopedCompositorWorkerForTest, | 36 private ScopedCompositorWorkerForTest, |
36 public testing::Test { | 37 public ::testing::Test { |
37 public: | 38 public: |
38 CompositorWorkerTest() | 39 CompositorWorkerTest() |
39 : ScopedRootLayerScrollingForTest(GetParam()), | 40 : ScopedRootLayerScrollingForTest(GetParam()), |
40 ScopedCompositorWorkerForTest(true), | 41 ScopedCompositorWorkerForTest(true), |
41 m_baseURL("http://www.test.com/") {} | 42 m_baseURL("http://www.test.com/") {} |
42 | 43 |
43 void SetUp() override { | 44 void SetUp() override { |
44 m_helper.initialize(true, nullptr, &m_mockWebViewClient, nullptr, | 45 m_helper.initialize(true, nullptr, &m_mockWebViewClient, nullptr, |
45 &configureSettings); | 46 &configureSettings); |
46 webViewImpl()->resize(IntSize(320, 240)); | 47 webViewImpl()->resize(IntSize(320, 240)); |
47 } | 48 } |
48 | 49 |
49 ~CompositorWorkerTest() override { | 50 ~CompositorWorkerTest() override { |
50 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); | 51 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); |
51 WebCache::clear(); | 52 WebCache::clear(); |
52 } | 53 } |
53 | 54 |
54 void navigateTo(const String& url) { | 55 void navigateTo(const String& url) { |
55 FrameTestHelpers::loadFrame(webViewImpl()->mainFrame(), url.utf8().data()); | 56 FrameTestHelpers::loadFrame(webViewImpl()->mainFrame(), url.utf8().data()); |
56 } | 57 } |
57 | 58 |
58 void forceFullCompositingUpdate() { | 59 void forceFullCompositingUpdate() { |
59 webViewImpl()->updateAllLifecyclePhases(); | 60 webViewImpl()->updateAllLifecyclePhases(); |
60 } | 61 } |
61 | 62 |
62 void registerMockedHttpURLLoad(const std::string& fileName) { | 63 void registerMockedHttpURLLoad(const std::string& fileName) { |
63 URLTestHelpers::registerMockedURLFromBaseURL( | 64 URLTestHelpers::registerMockedURLLoadFromBase( |
64 m_baseURL, WebString::fromUTF8(fileName.c_str())); | 65 m_baseURL, testing::webTestDataPath(), WebString::fromUTF8(fileName)); |
65 } | 66 } |
66 | 67 |
67 WebLayer* getRootScrollLayer() { | 68 WebLayer* getRootScrollLayer() { |
68 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 69 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
69 DCHECK(frame()); | 70 DCHECK(frame()); |
70 DCHECK(frame()->view()); | 71 DCHECK(frame()->view()); |
71 DCHECK(frame()->view()->layoutViewportScrollableArea()); | 72 DCHECK(frame()->view()->layoutViewportScrollableArea()); |
72 DCHECK( | 73 DCHECK( |
73 frame()->view()->layoutViewportScrollableArea()->layerForScrolling()); | 74 frame()->view()->layoutViewportScrollableArea()->layerForScrolling()); |
74 return frame() | 75 return frame() |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
365 | 366 |
366 const String& opacityValue = | 367 const String& opacityValue = |
367 document->domWindow() | 368 document->domWindow() |
368 ->getComputedStyle(proxiedElement, String()) | 369 ->getComputedStyle(proxiedElement, String()) |
369 ->getPropertyValueInternal(CSSPropertyOpacity); | 370 ->getPropertyValueInternal(CSSPropertyOpacity); |
370 EXPECT_EQ("0.8", opacityValue); | 371 EXPECT_EQ("0.8", opacityValue); |
371 } | 372 } |
372 } | 373 } |
373 | 374 |
374 } // namespace blink | 375 } // namespace blink |
OLD | NEW |