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

Side by Side Diff: third_party/WebKit/Source/core/paint/VideoPainterTest.cpp

Issue 2719813002: Rename classes that derived from EmptyLocalFrameClient. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreePrinterTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/paint/VideoPainter.h" 5 #include "core/paint/VideoPainter.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/Settings.h" 8 #include "core/frame/Settings.h"
9 #include "core/html/HTMLMediaElement.h" 9 #include "core/html/HTMLMediaElement.h"
10 #include "core/loader/EmptyClients.h" 10 #include "core/loader/EmptyClients.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 size_t videoDecodedByteCount() const override { return 0; } 72 size_t videoDecodedByteCount() const override { return 0; }
73 void paint(WebCanvas*, const WebRect&, PaintFlags&) override {} 73 void paint(WebCanvas*, const WebRect&, PaintFlags&) override {}
74 74
75 private: 75 private:
76 WebMediaPlayerClient* m_client; 76 WebMediaPlayerClient* m_client;
77 std::unique_ptr<WebLayer> m_webLayer; 77 std::unique_ptr<WebLayer> m_webLayer;
78 NetworkState m_networkState = NetworkStateEmpty; 78 NetworkState m_networkState = NetworkStateEmpty;
79 ReadyState m_readyState = ReadyStateHaveNothing; 79 ReadyState m_readyState = ReadyStateHaveNothing;
80 }; 80 };
81 81
82 class StubFrameLoaderClient : public EmptyLocalFrameClient { 82 class StubLocalFrameClient : public EmptyLocalFrameClient {
83 public: 83 public:
84 // FrameLoaderClient 84 // FrameLoaderClient
85 std::unique_ptr<WebMediaPlayer> createWebMediaPlayer( 85 std::unique_ptr<WebMediaPlayer> createWebMediaPlayer(
86 HTMLMediaElement&, 86 HTMLMediaElement&,
87 const WebMediaPlayerSource&, 87 const WebMediaPlayerSource&,
88 WebMediaPlayerClient* client) override { 88 WebMediaPlayerClient* client) override {
89 return WTF::makeUnique<StubWebMediaPlayer>(client); 89 return WTF::makeUnique<StubWebMediaPlayer>(client);
90 } 90 }
91 }; 91 };
92 92
93 class VideoPainterTestForSPv2 : public ::testing::Test, 93 class VideoPainterTestForSPv2 : public ::testing::Test,
94 private ScopedSlimmingPaintV2ForTest { 94 private ScopedSlimmingPaintV2ForTest {
95 public: 95 public:
96 VideoPainterTestForSPv2() : ScopedSlimmingPaintV2ForTest(true) {} 96 VideoPainterTestForSPv2() : ScopedSlimmingPaintV2ForTest(true) {}
97 97
98 protected: 98 protected:
99 void SetUp() override { 99 void SetUp() override {
100 m_chromeClient = new StubChromeClientForSPv2(); 100 m_chromeClient = new StubChromeClientForSPv2();
101 m_frameLoaderClient = new StubFrameLoaderClient; 101 m_localFrameClient = new StubLocalFrameClient;
102 Page::PageClients clients; 102 Page::PageClients clients;
103 fillWithEmptyClients(clients); 103 fillWithEmptyClients(clients);
104 clients.chromeClient = m_chromeClient.get(); 104 clients.chromeClient = m_chromeClient.get();
105 m_pageHolder = DummyPageHolder::create( 105 m_pageHolder = DummyPageHolder::create(
106 IntSize(800, 600), &clients, m_frameLoaderClient.get(), 106 IntSize(800, 600), &clients, m_localFrameClient.get(),
107 [](Settings& settings) { 107 [](Settings& settings) {
108 settings.setAcceleratedCompositingEnabled(true); 108 settings.setAcceleratedCompositingEnabled(true);
109 }); 109 });
110 document().view()->setParentVisible(true); 110 document().view()->setParentVisible(true);
111 document().view()->setSelfVisible(true); 111 document().view()->setSelfVisible(true);
112 document().setURL(KURL(KURL(), "https://example.com/")); 112 document().setURL(KURL(KURL(), "https://example.com/"));
113 } 113 }
114 114
115 Document& document() { return m_pageHolder->document(); } 115 Document& document() { return m_pageHolder->document(); }
116 bool hasLayerAttached(const WebLayer& layer) { 116 bool hasLayerAttached(const WebLayer& layer) {
117 return m_chromeClient->hasLayer(layer); 117 return m_chromeClient->hasLayer(layer);
118 } 118 }
119 119
120 private: 120 private:
121 Persistent<StubChromeClientForSPv2> m_chromeClient; 121 Persistent<StubChromeClientForSPv2> m_chromeClient;
122 Persistent<StubFrameLoaderClient> m_frameLoaderClient; 122 Persistent<StubLocalFrameClient> m_localFrameClient;
123 std::unique_ptr<DummyPageHolder> m_pageHolder; 123 std::unique_ptr<DummyPageHolder> m_pageHolder;
124 }; 124 };
125 125
126 TEST_F(VideoPainterTestForSPv2, VideoLayerAppearsInLayerTree) { 126 TEST_F(VideoPainterTestForSPv2, VideoLayerAppearsInLayerTree) {
127 // Insert a <video> and allow it to begin loading. 127 // Insert a <video> and allow it to begin loading.
128 document().body()->setInnerHTML("<video width=300 height=200 src=test.ogv>"); 128 document().body()->setInnerHTML("<video width=300 height=200 src=test.ogv>");
129 testing::runPendingTasks(); 129 testing::runPendingTasks();
130 130
131 // Force the page to paint. 131 // Force the page to paint.
132 document().view()->updateAllLifecyclePhases(); 132 document().view()->updateAllLifecyclePhases();
133 133
134 // Fetch the layer associated with the <video>, and check that it was 134 // Fetch the layer associated with the <video>, and check that it was
135 // correctly configured in the layer tree. 135 // correctly configured in the layer tree.
136 HTMLMediaElement* element = 136 HTMLMediaElement* element =
137 toHTMLMediaElement(document().body()->firstChild()); 137 toHTMLMediaElement(document().body()->firstChild());
138 StubWebMediaPlayer* player = 138 StubWebMediaPlayer* player =
139 static_cast<StubWebMediaPlayer*>(element->webMediaPlayer()); 139 static_cast<StubWebMediaPlayer*>(element->webMediaPlayer());
140 const WebLayer* layer = player->getWebLayer(); 140 const WebLayer* layer = player->getWebLayer();
141 ASSERT_TRUE(layer); 141 ASSERT_TRUE(layer);
142 EXPECT_TRUE(hasLayerAttached(*layer)); 142 EXPECT_TRUE(hasLayerAttached(*layer));
143 EXPECT_EQ(WebSize(300, 200), layer->bounds()); 143 EXPECT_EQ(WebSize(300, 200), layer->bounds());
144 } 144 }
145 145
146 } // namespace 146 } // namespace
147 } // namespace blink 147 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreePrinterTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698