| 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 "core/frame/FrameView.h" | 5 #include "core/frame/FrameView.h" |
| 6 #include "core/layout/api/LayoutViewItem.h" | 6 #include "core/layout/api/LayoutViewItem.h" |
| 7 #include "core/layout/compositing/CompositedLayerMapping.h" | 7 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 8 #include "core/layout/compositing/PaintLayerCompositor.h" | 8 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 9 #include "core/page/Page.h" | 9 #include "core/page/Page.h" |
| 10 #include "platform/graphics/CompositorMutableProperties.h" | 10 #include "platform/graphics/CompositorMutableProperties.h" |
| 11 #include "platform/graphics/GraphicsLayer.h" | 11 #include "platform/graphics/GraphicsLayer.h" |
| 12 #include "platform/testing/URLTestHelpers.h" | 12 #include "platform/testing/URLTestHelpers.h" |
| 13 #include "public/platform/Platform.h" | 13 #include "public/platform/Platform.h" |
| 14 #include "public/platform/WebLayer.h" | 14 #include "public/platform/WebLayer.h" |
| 15 #include "public/platform/WebLayerTreeView.h" | 15 #include "public/platform/WebLayerTreeView.h" |
| 16 #include "public/platform/WebUnitTestSupport.h" | 16 #include "public/platform/WebURLLoaderMockFactory.h" |
| 17 #include "public/web/WebCache.h" |
| 17 #include "public/web/WebSettings.h" | 18 #include "public/web/WebSettings.h" |
| 18 #include "public/web/WebViewClient.h" | 19 #include "public/web/WebViewClient.h" |
| 19 #include "web/WebLocalFrameImpl.h" | 20 #include "web/WebLocalFrameImpl.h" |
| 20 #include "web/WebViewImpl.h" | 21 #include "web/WebViewImpl.h" |
| 21 #include "web/tests/FrameTestHelpers.h" | 22 #include "web/tests/FrameTestHelpers.h" |
| 22 #include <gtest/gtest.h> | 23 #include <gtest/gtest.h> |
| 23 | 24 |
| 24 namespace blink { | 25 namespace blink { |
| 25 | 26 |
| 26 class CompositorWorkerTest : public testing::Test { | 27 class CompositorWorkerTest : public testing::Test { |
| 27 public: | 28 public: |
| 28 CompositorWorkerTest() | 29 CompositorWorkerTest() |
| 29 : m_baseURL("http://www.test.com/") | 30 : m_baseURL("http://www.test.com/") |
| 30 { | 31 { |
| 31 RuntimeEnabledFeatures::setCompositorWorkerEnabled(true); | 32 RuntimeEnabledFeatures::setCompositorWorkerEnabled(true); |
| 32 m_helper.initialize(true, 0, &m_mockWebViewClient, &configureSettings); | 33 m_helper.initialize(true, 0, &m_mockWebViewClient, &configureSettings); |
| 33 webViewImpl()->resize(IntSize(320, 240)); | 34 webViewImpl()->resize(IntSize(320, 240)); |
| 34 } | 35 } |
| 35 | 36 |
| 36 ~CompositorWorkerTest() override | 37 ~CompositorWorkerTest() override |
| 37 { | 38 { |
| 38 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 39 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); |
| 40 WebCache::clear(); |
| 39 } | 41 } |
| 40 | 42 |
| 41 void navigateTo(const String& url) | 43 void navigateTo(const String& url) |
| 42 { | 44 { |
| 43 FrameTestHelpers::loadFrame(webViewImpl()->mainFrame(), url.utf8().data(
)); | 45 FrameTestHelpers::loadFrame(webViewImpl()->mainFrame(), url.utf8().data(
)); |
| 44 } | 46 } |
| 45 | 47 |
| 46 void forceFullCompositingUpdate() | 48 void forceFullCompositingUpdate() |
| 47 { | 49 { |
| 48 webViewImpl()->updateAllLifecyclePhases(); | 50 webViewImpl()->updateAllLifecyclePhases(); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 WebLayer* scrollLayer = scrollingWebLayerFromElement(scrollElement); | 206 WebLayer* scrollLayer = scrollingWebLayerFromElement(scrollElement); |
| 205 EXPECT_FALSE(!!scrollLayer->compositorMutableProperties()); | 207 EXPECT_FALSE(!!scrollLayer->compositorMutableProperties()); |
| 206 EXPECT_EQ(0UL, scrollLayer->elementId()); | 208 EXPECT_EQ(0UL, scrollLayer->elementId()); |
| 207 | 209 |
| 208 WebLayer* rootScrollLayer = getRootScrollLayer(); | 210 WebLayer* rootScrollLayer = getRootScrollLayer(); |
| 209 EXPECT_FALSE(!!rootScrollLayer->compositorMutableProperties()); | 211 EXPECT_FALSE(!!rootScrollLayer->compositorMutableProperties()); |
| 210 EXPECT_EQ(0UL, rootScrollLayer->elementId()); | 212 EXPECT_EQ(0UL, rootScrollLayer->elementId()); |
| 211 } | 213 } |
| 212 | 214 |
| 213 } // namespace blink | 215 } // namespace blink |
| OLD | NEW |