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

Side by Side Diff: third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp

Issue 2867693004: Snapshot of all changes to get jumbo in blink and content.
Patch Set: Rebased again Created 3 years, 5 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 "modules/media_controls/MediaControlsImpl.h" 5 #include "modules/media_controls/MediaControlsImpl.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <memory> 8 #include <memory>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #if defined(OS_ANDROID) 46 #if defined(OS_ANDROID)
47 #define TIMELINE_W "80_127" 47 #define TIMELINE_W "80_127"
48 #else 48 #else
49 #define TIMELINE_W "128_255" 49 #define TIMELINE_W "128_255"
50 #endif 50 #endif
51 51
52 namespace blink { 52 namespace blink {
53 53
54 namespace { 54 namespace {
55 55
56 class MockChromeClient : public EmptyChromeClient { 56 class MockChromeClientForImpl : public EmptyChromeClient {
57 public: 57 public:
58 // EmptyChromeClient overrides: 58 // EmptyChromeClient overrides:
59 WebScreenInfo GetScreenInfo() const override { 59 WebScreenInfo GetScreenInfo() const override {
60 WebScreenInfo screen_info; 60 WebScreenInfo screen_info;
61 screen_info.orientation_type = kWebScreenOrientationLandscapePrimary; 61 screen_info.orientation_type = kWebScreenOrientationLandscapePrimary;
62 return screen_info; 62 return screen_info;
63 } 63 }
64 }; 64 };
65 65
66 class MockVideoWebMediaPlayer : public EmptyWebMediaPlayer { 66 class MockWebMediaPlayerForImpl : public EmptyWebMediaPlayer {
67 public: 67 public:
68 // WebMediaPlayer overrides: 68 // WebMediaPlayer overrides:
69 WebTimeRanges Seekable() const override { return seekable_; } 69 WebTimeRanges Seekable() const override { return seekable_; }
70 bool HasVideo() const override { return true; } 70 bool HasVideo() const override { return true; }
71 71
72 WebTimeRanges seekable_; 72 WebTimeRanges seekable_;
73 }; 73 };
74 74
75 class MockLayoutObject : public LayoutObject { 75 class MockLayoutObject : public LayoutObject {
76 public: 76 public:
77 MockLayoutObject(Node* node) : LayoutObject(node) {} 77 MockLayoutObject(Node* node) : LayoutObject(node) {}
78 78
79 const char* GetName() const override { return "MockLayoutObject"; } 79 const char* GetName() const override { return "MockLayoutObject"; }
80 void UpdateLayout() override {} 80 void UpdateLayout() override {}
81 FloatRect LocalBoundingBoxRectForAccessibility() const override { 81 FloatRect LocalBoundingBoxRectForAccessibility() const override {
82 return FloatRect(); 82 return FloatRect();
83 } 83 }
84 }; 84 };
85 85
86 class StubLocalFrameClient : public EmptyLocalFrameClient { 86 class StubLocalFrameClientForImpl : public EmptyLocalFrameClient {
87 public: 87 public:
88 static StubLocalFrameClient* Create() { return new StubLocalFrameClient; } 88 static StubLocalFrameClientForImpl* Create() {
89 return new StubLocalFrameClientForImpl;
90 }
89 91
90 std::unique_ptr<WebMediaPlayer> CreateWebMediaPlayer( 92 std::unique_ptr<WebMediaPlayer> CreateWebMediaPlayer(
91 HTMLMediaElement&, 93 HTMLMediaElement&,
92 const WebMediaPlayerSource&, 94 const WebMediaPlayerSource&,
93 WebMediaPlayerClient*) override { 95 WebMediaPlayerClient*) override {
94 return WTF::WrapUnique(new MockVideoWebMediaPlayer); 96 return WTF::WrapUnique(new MockWebMediaPlayerForImpl);
95 } 97 }
96 98
97 WebRemotePlaybackClient* CreateWebRemotePlaybackClient( 99 WebRemotePlaybackClient* CreateWebRemotePlaybackClient(
98 HTMLMediaElement& element) override { 100 HTMLMediaElement& element) override {
99 return HTMLMediaElementRemotePlayback::remote(element); 101 return HTMLMediaElementRemotePlayback::remote(element);
100 } 102 }
101 }; 103 };
102 104
103 Element* GetElementByShadowPseudoId(Node& root_node, 105 Element* GetElementByShadowPseudoId(Node& root_node,
104 const char* shadow_pseudo_id) { 106 const char* shadow_pseudo_id) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 virtual void SetUp() { 148 virtual void SetUp() {
147 // Enable the cast overlay button as this is enabled by default. 149 // Enable the cast overlay button as this is enabled by default.
148 RuntimeEnabledFeatures::SetMediaCastOverlayButtonEnabled(true); 150 RuntimeEnabledFeatures::SetMediaCastOverlayButtonEnabled(true);
149 151
150 InitializePage(); 152 InitializePage();
151 } 153 }
152 154
153 void InitializePage() { 155 void InitializePage() {
154 Page::PageClients clients; 156 Page::PageClients clients;
155 FillWithEmptyClients(clients); 157 FillWithEmptyClients(clients);
156 clients.chrome_client = new MockChromeClient(); 158 clients.chrome_client = new MockChromeClientForImpl();
157 page_holder_ = DummyPageHolder::Create(IntSize(800, 600), &clients, 159 page_holder_ = DummyPageHolder::Create(
158 StubLocalFrameClient::Create()); 160 IntSize(800, 600), &clients, StubLocalFrameClientForImpl::Create());
159 161
160 GetDocument().write("<video>"); 162 GetDocument().write("<video>");
161 HTMLVideoElement& video = 163 HTMLVideoElement& video =
162 toHTMLVideoElement(*GetDocument().QuerySelector("video")); 164 toHTMLVideoElement(*GetDocument().QuerySelector("video"));
163 media_controls_ = static_cast<MediaControlsImpl*>(video.GetMediaControls()); 165 media_controls_ = static_cast<MediaControlsImpl*>(video.GetMediaControls());
164 166
165 // If scripts are not enabled, controls will always be shown. 167 // If scripts are not enabled, controls will always be shown.
166 page_holder_->GetFrame().GetSettings()->SetScriptEnabled(true); 168 page_holder_->GetFrame().GetSettings()->SetScriptEnabled(true);
167 } 169 }
168 170
(...skipping 18 matching lines...) Expand all
187 MediaControlsImpl& MediaControls() { return *media_controls_; } 189 MediaControlsImpl& MediaControls() { return *media_controls_; }
188 MediaControlVolumeSliderElement* VolumeSliderElement() const { 190 MediaControlVolumeSliderElement* VolumeSliderElement() const {
189 return media_controls_->volume_slider_; 191 return media_controls_->volume_slider_;
190 } 192 }
191 MediaControlTimelineElement* TimelineElement() const { 193 MediaControlTimelineElement* TimelineElement() const {
192 return media_controls_->timeline_; 194 return media_controls_->timeline_;
193 } 195 }
194 MediaControlCurrentTimeDisplayElement* GetCurrentTimeDisplayElement() const { 196 MediaControlCurrentTimeDisplayElement* GetCurrentTimeDisplayElement() const {
195 return media_controls_->current_time_display_; 197 return media_controls_->current_time_display_;
196 } 198 }
197 MockVideoWebMediaPlayer* WebMediaPlayer() { 199 MockWebMediaPlayerForImpl* WebMediaPlayer() {
198 return static_cast<MockVideoWebMediaPlayer*>( 200 return static_cast<MockWebMediaPlayerForImpl*>(
199 MediaControls().MediaElement().GetWebMediaPlayer()); 201 MediaControls().MediaElement().GetWebMediaPlayer());
200 } 202 }
201 Document& GetDocument() { return page_holder_->GetDocument(); } 203 Document& GetDocument() { return page_holder_->GetDocument(); }
202 204
203 HistogramTester& GetHistogramTester() { return histogram_tester_; } 205 HistogramTester& GetHistogramTester() { return histogram_tester_; }
204 206
205 void LoadMediaWithDuration(double duration) { 207 void LoadMediaWithDuration(double duration) {
206 MediaControls().MediaElement().SetSrc("https://example.com/foo.mp4"); 208 MediaControls().MediaElement().SetSrc("https://example.com/foo.mp4");
207 testing::RunPendingTasks(); 209 testing::RunPendingTasks();
208 WebTimeRange time_range(0.0, duration); 210 WebTimeRange time_range(0.0, duration);
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 { 852 {
851 Persistent<HTMLMediaElement> video_holder = element; 853 Persistent<HTMLMediaElement> video_holder = element;
852 page_holder->GetDocument().body()->RemoveChild(element); 854 page_holder->GetDocument().body()->RemoveChild(element);
853 page_holder->GetDocument().body()->AppendChild(video_holder.Get()); 855 page_holder->GetDocument().body()->AppendChild(video_holder.Get());
854 EXPECT_TRUE(remote_playback->HasEventListeners()); 856 EXPECT_TRUE(remote_playback->HasEventListeners());
855 EXPECT_TRUE(HasAvailabilityCallbacks(remote_playback)); 857 EXPECT_TRUE(HasAvailabilityCallbacks(remote_playback));
856 } 858 }
857 } 859 }
858 860
859 } // namespace blink 861 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698