Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp

Issue 2654933003: platform/testing/{URL|Unit}TestHelpers improvements (Closed)
Patch Set: cleanup Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/CompositorMutation.h" 11 #include "platform/graphics/CompositorMutation.h"
12 #include "platform/graphics/GraphicsLayer.h" 12 #include "platform/graphics/GraphicsLayer.h"
13 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" 13 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
14 #include "platform/testing/URLTestHelpers.h" 14 #include "platform/testing/URLTestHelpers.h"
15 #include "platform/testing/UnitTestHelpers.h"
15 #include "public/platform/Platform.h" 16 #include "public/platform/Platform.h"
16 #include "public/platform/WebLayer.h" 17 #include "public/platform/WebLayer.h"
17 #include "public/platform/WebLayerTreeView.h" 18 #include "public/platform/WebLayerTreeView.h"
18 #include "public/platform/WebURLLoaderMockFactory.h" 19 #include "public/platform/WebURLLoaderMockFactory.h"
19 #include "public/web/WebCache.h" 20 #include "public/web/WebCache.h"
20 #include "public/web/WebSettings.h" 21 #include "public/web/WebSettings.h"
21 #include "public/web/WebViewClient.h" 22 #include "public/web/WebViewClient.h"
22 #include "web/WebLocalFrameImpl.h" 23 #include "web/WebLocalFrameImpl.h"
23 #include "web/WebViewImpl.h" 24 #include "web/WebViewImpl.h"
24 #include "web/tests/FrameTestHelpers.h" 25 #include "web/tests/FrameTestHelpers.h"
25 #include "wtf/PtrUtil.h" 26 #include "wtf/PtrUtil.h"
26 #include <gtest/gtest.h> 27 #include <gtest/gtest.h>
27 #include <memory> 28 #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(),
66 WebString::fromUTF8(fileName.c_str()));
Takashi Toyoshima 2017/01/26 10:57:58 removing c_str
65 } 67 }
66 68
67 WebLayer* getRootScrollLayer() { 69 WebLayer* getRootScrollLayer() {
68 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 70 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
69 DCHECK(frame()); 71 DCHECK(frame());
70 DCHECK(frame()->view()); 72 DCHECK(frame()->view());
71 DCHECK(frame()->view()->layoutViewportScrollableArea()); 73 DCHECK(frame()->view()->layoutViewportScrollableArea());
72 DCHECK( 74 DCHECK(
73 frame()->view()->layoutViewportScrollableArea()->layerForScrolling()); 75 frame()->view()->layoutViewportScrollableArea()->layerForScrolling());
74 return frame() 76 return frame()
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 367
366 const String& opacityValue = 368 const String& opacityValue =
367 document->domWindow() 369 document->domWindow()
368 ->getComputedStyle(proxiedElement, String()) 370 ->getComputedStyle(proxiedElement, String())
369 ->getPropertyValueInternal(CSSPropertyOpacity); 371 ->getPropertyValueInternal(CSSPropertyOpacity);
370 EXPECT_EQ("0.8", opacityValue); 372 EXPECT_EQ("0.8", opacityValue);
371 } 373 }
372 } 374 }
373 375
374 } // namespace blink 376 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698