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

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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/html/shadow/MediaControls.h" 5 #include "core/html/shadow/MediaControls.h"
6 6
7 #include "core/HTMLNames.h" 7 #include "core/HTMLNames.h"
8 #include "core/css/StylePropertySet.h" 8 #include "core/css/StylePropertySet.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/ElementTraversal.h" 10 #include "core/dom/ElementTraversal.h"
11 #include "core/dom/StyleEngine.h" 11 #include "core/dom/StyleEngine.h"
12 #include "core/frame/Settings.h" 12 #include "core/frame/Settings.h"
13 #include "core/html/HTMLVideoElement.h" 13 #include "core/html/HTMLVideoElement.h"
14 #include "core/testing/DummyPageHolder.h" 14 #include "core/testing/DummyPageHolder.h"
15 #include "platform/heap/Handle.h" 15 #include "platform/heap/Handle.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include <memory>
17 18
18 namespace blink { 19 namespace blink {
19 20
20 namespace { 21 namespace {
21 22
22 Element* getElementByShadowPseudoId(Node& rootNode, const char* shadowPseudoId) 23 Element* getElementByShadowPseudoId(Node& rootNode, const char* shadowPseudoId)
23 { 24 {
24 for (Element& element : ElementTraversal::descendantsOf(rootNode)) { 25 for (Element& element : ElementTraversal::descendantsOf(rootNode)) {
25 if (element.shadowPseudoId() == shadowPseudoId) 26 if (element.shadowPseudoId() == shadowPseudoId)
26 return &element; 27 return &element;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 { 78 {
78 // Force a relayout, so that the controls know the width. Otherwise, 79 // Force a relayout, so that the controls know the width. Otherwise,
79 // they don't know if, for example, the cast button will fit. 80 // they don't know if, for example, the cast button will fit.
80 m_mediaControls->mediaElement().clientWidth(); 81 m_mediaControls->mediaElement().clientWidth();
81 } 82 }
82 83
83 MediaControls& mediaControls() { return *m_mediaControls; } 84 MediaControls& mediaControls() { return *m_mediaControls; }
84 Document& document() { return m_pageHolder->document(); } 85 Document& document() { return m_pageHolder->document(); }
85 86
86 private: 87 private:
87 OwnPtr<DummyPageHolder> m_pageHolder; 88 std::unique_ptr<DummyPageHolder> m_pageHolder;
88 Persistent<MediaControls> m_mediaControls; 89 Persistent<MediaControls> m_mediaControls;
89 }; 90 };
90 91
91 TEST_F(MediaControlsTest, HideAndShow) 92 TEST_F(MediaControlsTest, HideAndShow)
92 { 93 {
93 mediaControls().mediaElement().setBooleanAttribute(HTMLNames::controlsAttr, true); 94 mediaControls().mediaElement().setBooleanAttribute(HTMLNames::controlsAttr, true);
94 95
95 Element* panel = getElementByShadowPseudoId(mediaControls(), "-webkit-media- controls-panel"); 96 Element* panel = getElementByShadowPseudoId(mediaControls(), "-webkit-media- controls-panel");
96 ASSERT_NE(nullptr, panel); 97 ASSERT_NE(nullptr, panel);
97 98
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 mediaControls().mediaElement().setBooleanAttribute(HTMLNames::disableremotep laybackAttr, true); 188 mediaControls().mediaElement().setBooleanAttribute(HTMLNames::disableremotep laybackAttr, true);
188 simulateRouteAvailabe(); 189 simulateRouteAvailabe();
189 ASSERT_FALSE(isElementVisible(*castOverlayButton)); 190 ASSERT_FALSE(isElementVisible(*castOverlayButton));
190 191
191 mediaControls().mediaElement().setBooleanAttribute(HTMLNames::disableremotep laybackAttr, false); 192 mediaControls().mediaElement().setBooleanAttribute(HTMLNames::disableremotep laybackAttr, false);
192 mediaControls().reset(); 193 mediaControls().reset();
193 ASSERT_TRUE(isElementVisible(*castOverlayButton)); 194 ASSERT_TRUE(isElementVisible(*castOverlayButton));
194 } 195 }
195 196
196 } // namespace blink 197 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698