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

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

Issue 2860673002: Change all test cases to use WebViewBase instead of WebViewImpl. (Closed)
Patch Set: Address code review comments. Created 3 years, 7 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 <gtest/gtest.h> 5 #include <gtest/gtest.h>
6 #include <memory> 6 #include <memory>
7 #include "core/exported/WebViewBase.h" 7 #include "core/exported/WebViewBase.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/layout/api/LayoutViewItem.h" 9 #include "core/layout/api/LayoutViewItem.h"
10 #include "core/layout/compositing/CompositedLayerMapping.h" 10 #include "core/layout/compositing/CompositedLayerMapping.h"
(...skipping 26 matching lines...) Expand all
37 public ::testing::Test { 37 public ::testing::Test {
38 public: 38 public:
39 CompositorWorkerTest() 39 CompositorWorkerTest()
40 : ScopedRootLayerScrollingForTest(GetParam()), 40 : ScopedRootLayerScrollingForTest(GetParam()),
41 ScopedCompositorWorkerForTest(true), 41 ScopedCompositorWorkerForTest(true),
42 base_url_("http://www.test.com/") {} 42 base_url_("http://www.test.com/") {}
43 43
44 void SetUp() override { 44 void SetUp() override {
45 helper_.Initialize(true, nullptr, &mock_web_view_client_, nullptr, 45 helper_.Initialize(true, nullptr, &mock_web_view_client_, nullptr,
46 &ConfigureSettings); 46 &ConfigureSettings);
47 GetWebViewImpl()->Resize(IntSize(320, 240)); 47 GetWebView()->Resize(IntSize(320, 240));
48 } 48 }
49 49
50 ~CompositorWorkerTest() override { 50 ~CompositorWorkerTest() override {
51 Platform::Current() 51 Platform::Current()
52 ->GetURLLoaderMockFactory() 52 ->GetURLLoaderMockFactory()
53 ->UnregisterAllURLsAndClearMemoryCache(); 53 ->UnregisterAllURLsAndClearMemoryCache();
54 } 54 }
55 55
56 void NavigateTo(const String& url) { 56 void NavigateTo(const String& url) {
57 FrameTestHelpers::LoadFrame(GetWebViewImpl()->MainFrame(), 57 FrameTestHelpers::LoadFrame(GetWebView()->MainFrame(), url.Utf8().data());
58 url.Utf8().data());
59 } 58 }
60 59
61 void ForceFullCompositingUpdate() { 60 void ForceFullCompositingUpdate() {
62 GetWebViewImpl()->UpdateAllLifecyclePhases(); 61 GetWebView()->UpdateAllLifecyclePhases();
63 } 62 }
64 63
65 void RegisterMockedHttpURLLoad(const std::string& file_name) { 64 void RegisterMockedHttpURLLoad(const std::string& file_name) {
66 URLTestHelpers::RegisterMockedURLLoadFromBase( 65 URLTestHelpers::RegisterMockedURLLoadFromBase(
67 base_url_, testing::WebTestDataPath(), WebString::FromUTF8(file_name)); 66 base_url_, testing::WebTestDataPath(), WebString::FromUTF8(file_name));
68 } 67 }
69 68
70 WebLayer* GetRootScrollLayer() { 69 WebLayer* GetRootScrollLayer() {
71 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 70 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
72 DCHECK(GetFrame()); 71 DCHECK(GetFrame());
(...skipping 11 matching lines...) Expand all
84 } 83 }
85 PaintLayerCompositor* compositor = 84 PaintLayerCompositor* compositor =
86 GetFrame()->ContentLayoutItem().Compositor(); 85 GetFrame()->ContentLayoutItem().Compositor();
87 DCHECK(compositor); 86 DCHECK(compositor);
88 DCHECK(compositor->ScrollLayer()); 87 DCHECK(compositor->ScrollLayer());
89 88
90 WebLayer* web_scroll_layer = compositor->ScrollLayer()->PlatformLayer(); 89 WebLayer* web_scroll_layer = compositor->ScrollLayer()->PlatformLayer();
91 return web_scroll_layer; 90 return web_scroll_layer;
92 } 91 }
93 92
94 WebViewImpl* GetWebViewImpl() const { return helper_.WebView(); } 93 WebViewBase* GetWebView() const { return helper_.WebView(); }
95 LocalFrame* GetFrame() const { 94 LocalFrame* GetFrame() const {
96 return helper_.WebView()->MainFrameImpl()->GetFrame(); 95 return helper_.WebView()->MainFrameImpl()->GetFrame();
97 } 96 }
98 97
99 protected: 98 protected:
100 String base_url_; 99 String base_url_;
101 FrameTestHelpers::TestWebViewClient mock_web_view_client_; 100 FrameTestHelpers::TestWebViewClient mock_web_view_client_;
102 101
103 private: 102 private:
104 static void ConfigureSettings(WebSettings* settings) { 103 static void ConfigureSettings(WebSettings* settings) {
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 373
375 const String& opacity_value = 374 const String& opacity_value =
376 document->domWindow() 375 document->domWindow()
377 ->getComputedStyle(proxied_element, String()) 376 ->getComputedStyle(proxied_element, String())
378 ->GetPropertyValueInternal(CSSPropertyOpacity); 377 ->GetPropertyValueInternal(CSSPropertyOpacity);
379 EXPECT_EQ("0.8", opacity_value); 378 EXPECT_EQ("0.8", opacity_value);
380 } 379 }
381 } 380 }
382 381
383 } // namespace blink 382 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698