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

Side by Side Diff: media/blink/webmediaplayer_impl_unittest.cc

Issue 2815303006: Convert MediaLog from being ref counted to owned by WebMediaPlayer. (Closed)
Patch Set: Rebase. Created 3 years, 8 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 | « media/blink/webmediaplayer_impl.cc ('k') | media/blink/webmediaplayer_params.h » ('j') | 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 "media/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 WebMediaPlayerImplTest() 197 WebMediaPlayerImplTest()
198 : media_thread_("MediaThreadForTest"), 198 : media_thread_("MediaThreadForTest"),
199 web_view_( 199 web_view_(
200 blink::WebView::Create(nullptr, 200 blink::WebView::Create(nullptr,
201 blink::kWebPageVisibilityStateVisible)), 201 blink::kWebPageVisibilityStateVisible)),
202 web_local_frame_( 202 web_local_frame_(
203 blink::WebLocalFrame::Create(blink::WebTreeScopeType::kDocument, 203 blink::WebLocalFrame::Create(blink::WebTreeScopeType::kDocument,
204 &web_frame_client_, 204 &web_frame_client_,
205 nullptr, 205 nullptr,
206 nullptr)), 206 nullptr)),
207 media_log_(new MediaLog()),
208 audio_parameters_(TestAudioParameters::Normal()) { 207 audio_parameters_(TestAudioParameters::Normal()) {
209 web_view_->SetMainFrame(web_local_frame_); 208 web_view_->SetMainFrame(web_local_frame_);
210 media_thread_.StartAndWaitForTesting(); 209 media_thread_.StartAndWaitForTesting();
211 } 210 }
212 211
213 void InitializeWebMediaPlayerImpl(bool allow_suspend) { 212 void InitializeWebMediaPlayerImpl(bool allow_suspend) {
213 std::unique_ptr<MediaLog> media_log(new MediaLog());
214 std::unique_ptr<RendererFactory> renderer_factory(
215 new DefaultRendererFactory(
216 media_log.get(), nullptr,
217 DefaultRendererFactory::GetGpuFactoriesCB()));
218
214 wmpi_ = base::MakeUnique<WebMediaPlayerImpl>( 219 wmpi_ = base::MakeUnique<WebMediaPlayerImpl>(
215 web_local_frame_, &client_, nullptr, &delegate_, 220 web_local_frame_, &client_, nullptr, &delegate_,
216 base::MakeUnique<DefaultRendererFactory>( 221 std::move(renderer_factory), url_index_,
217 media_log_, nullptr, DefaultRendererFactory::GetGpuFactoriesCB()), 222 base::MakeUnique<WebMediaPlayerParams>(
218 url_index_, 223 std::move(media_log), WebMediaPlayerParams::DeferLoadCB(),
219 WebMediaPlayerParams( 224 scoped_refptr<SwitchableAudioRendererSink>(),
220 WebMediaPlayerParams::DeferLoadCB(),
221 scoped_refptr<SwitchableAudioRendererSink>(), media_log_,
222 media_thread_.task_runner(), message_loop_.task_runner(), 225 media_thread_.task_runner(), message_loop_.task_runner(),
223 message_loop_.task_runner(), WebMediaPlayerParams::Context3DCB(), 226 message_loop_.task_runner(), WebMediaPlayerParams::Context3DCB(),
224 base::Bind(&OnAdjustAllocatedMemory), nullptr, nullptr, nullptr, 227 base::Bind(&OnAdjustAllocatedMemory), nullptr, nullptr, nullptr,
225 kMaxKeyframeDistanceToDisableBackgroundVideo, 228 kMaxKeyframeDistanceToDisableBackgroundVideo,
226 kMaxKeyframeDistanceToDisableBackgroundVideoMSE, false, 229 kMaxKeyframeDistanceToDisableBackgroundVideoMSE, false,
227 allow_suspend, false)); 230 allow_suspend, false));
228 } 231 }
229 232
230 ~WebMediaPlayerImplTest() override { 233 ~WebMediaPlayerImplTest() override {
231 // Destruct WebMediaPlayerImpl and pump the message loop to ensure that 234 // Destruct WebMediaPlayerImpl and pump the message loop to ensure that
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 352
350 // "Media" thread. This is necessary because WMPI destruction waits on a 353 // "Media" thread. This is necessary because WMPI destruction waits on a
351 // WaitableEvent. 354 // WaitableEvent.
352 base::Thread media_thread_; 355 base::Thread media_thread_;
353 356
354 // Blink state. 357 // Blink state.
355 blink::WebFrameClient web_frame_client_; 358 blink::WebFrameClient web_frame_client_;
356 blink::WebView* web_view_; 359 blink::WebView* web_view_;
357 blink::WebLocalFrame* web_local_frame_; 360 blink::WebLocalFrame* web_local_frame_;
358 361
359 scoped_refptr<MediaLog> media_log_;
360 linked_ptr<media::UrlIndex> url_index_; 362 linked_ptr<media::UrlIndex> url_index_;
361 363
362 // Audio hardware configuration. 364 // Audio hardware configuration.
363 AudioParameters audio_parameters_; 365 AudioParameters audio_parameters_;
364 366
365 // The client interface used by |wmpi_|. Just a dummy for now, but later we 367 // The client interface used by |wmpi_|. Just a dummy for now, but later we
366 // may want a mock or intelligent fake. 368 // may want a mock or intelligent fake.
367 DummyWebMediaPlayerClient client_; 369 DummyWebMediaPlayerClient client_;
368 370
369 testing::NiceMock<MockWebMediaPlayerDelegate> delegate_; 371 testing::NiceMock<MockWebMediaPlayerDelegate> delegate_;
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 WebMediaPlayerImplBackgroundBehaviorTest, 982 WebMediaPlayerImplBackgroundBehaviorTest,
981 ::testing::Combine(::testing::Bool(), 983 ::testing::Combine(::testing::Bool(),
982 ::testing::Bool(), 984 ::testing::Bool(),
983 ::testing::Values(5, 300), 985 ::testing::Values(5, 300),
984 ::testing::Values(5, 100), 986 ::testing::Values(5, 100),
985 ::testing::Bool(), 987 ::testing::Bool(),
986 ::testing::Bool(), 988 ::testing::Bool(),
987 ::testing::Bool())); 989 ::testing::Bool()));
988 990
989 } // namespace media 991 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/blink/webmediaplayer_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698