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

Side by Side Diff: content/browser/renderer_host/media/video_capture_host_unittest.cc

Issue 1806313003: Pass task runners to AudioManager constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: speculative hack to fix test timeouts Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 opened_session_id_(kInvalidMediaCaptureSessionId) {} 266 opened_session_id_(kInvalidMediaCaptureSessionId) {}
267 267
268 void SetUp() override { 268 void SetUp() override {
269 SetBrowserClientForTesting(&browser_client_); 269 SetBrowserClientForTesting(&browser_client_);
270 270
271 #if defined(OS_CHROMEOS) 271 #if defined(OS_CHROMEOS)
272 chromeos::CrasAudioHandler::InitializeForTesting(); 272 chromeos::CrasAudioHandler::InitializeForTesting();
273 #endif 273 #endif
274 274
275 // Create our own MediaStreamManager. 275 // Create our own MediaStreamManager.
276 audio_manager_.reset(media::AudioManager::CreateForTesting()); 276 audio_manager_ = media::AudioManager::CreateForTesting(task_runner_);
277 #ifndef TEST_REAL_CAPTURE_DEVICE 277 #ifndef TEST_REAL_CAPTURE_DEVICE
278 base::CommandLine::ForCurrentProcess()->AppendSwitch( 278 base::CommandLine::ForCurrentProcess()->AppendSwitch(
279 switches::kUseFakeDeviceForMediaStream); 279 switches::kUseFakeDeviceForMediaStream);
280 #endif 280 #endif
281 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get())); 281 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get()));
282 media_stream_manager_->UseFakeUIForTests( 282 media_stream_manager_->UseFakeUIForTests(
283 scoped_ptr<FakeMediaStreamUIProxy>()); 283 scoped_ptr<FakeMediaStreamUIProxy>());
284 284
285 // Create a Host and connect it to a simulated IPC channel. 285 // Create a Host and connect it to a simulated IPC channel.
286 host_ = new MockVideoCaptureHost(media_stream_manager_.get()); 286 host_ = new MockVideoCaptureHost(media_stream_manager_.get());
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 FROM_HERE, 476 FROM_HERE,
477 base::Bind(&base::DoNothing), 477 base::Bind(&base::DoNothing),
478 run_loop.QuitClosure()); 478 run_loop.QuitClosure());
479 run_loop.Run(); 479 run_loop.Run();
480 } 480 }
481 481
482 scoped_refptr<MockVideoCaptureHost> host_; 482 scoped_refptr<MockVideoCaptureHost> host_;
483 483
484 private: 484 private:
485 StrictMock<MockMediaStreamRequester> stream_requester_; 485 StrictMock<MockMediaStreamRequester> stream_requester_;
486 scoped_ptr<media::AudioManager> audio_manager_; 486 media::ScopedAudioManagerPtr audio_manager_;
487 scoped_ptr<MediaStreamManager> media_stream_manager_; 487 scoped_ptr<MediaStreamManager> media_stream_manager_;
488 content::TestBrowserThreadBundle thread_bundle_; 488 content::TestBrowserThreadBundle thread_bundle_;
489 content::TestBrowserContext browser_context_; 489 content::TestBrowserContext browser_context_;
490 content::TestContentBrowserClient browser_client_; 490 content::TestContentBrowserClient browser_client_;
491 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 491 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
492 int opened_session_id_; 492 int opened_session_id_;
493 std::string opened_device_label_; 493 std::string opened_device_label_;
494 494
495 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHostTest); 495 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHostTest);
496 }; 496 };
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 #ifdef DUMP_VIDEO 536 #ifdef DUMP_VIDEO
537 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { 537 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) {
538 CaptureAndDumpVideo(640, 480, 30); 538 CaptureAndDumpVideo(640, 480, 30);
539 } 539 }
540 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { 540 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) {
541 CaptureAndDumpVideo(1280, 720, 30); 541 CaptureAndDumpVideo(1280, 720, 30);
542 } 542 }
543 #endif 543 #endif
544 544
545 } // namespace content 545 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698