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

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

Issue 8818012: Remove the AudioManager singleton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Set svn eol properties for a couple of files Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/process_util.h" 12 #include "base/process_util.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "content/browser/browser_thread_impl.h" 15 #include "content/browser/browser_thread_impl.h"
16 #include "content/browser/mock_resource_context.h" 16 #include "content/browser/mock_resource_context.h"
17 #include "content/browser/renderer_host/media/media_stream_manager.h" 17 #include "content/browser/renderer_host/media/media_stream_manager.h"
18 #include "content/browser/renderer_host/media/video_capture_host.h" 18 #include "content/browser/renderer_host/media/video_capture_host.h"
19 #include "content/browser/renderer_host/media/video_capture_manager.h" 19 #include "content/browser/renderer_host/media/video_capture_manager.h"
20 #include "content/browser/resource_context.h" 20 #include "content/browser/resource_context.h"
21 #include "content/common/media/video_capture_messages.h" 21 #include "content/common/media/video_capture_messages.h"
22 #include "media/audio/audio_manager.h"
22 #include "media/video/capture/video_capture_types.h" 23 #include "media/video/capture/video_capture_types.h"
23 24
24 #include "testing/gmock/include/gmock/gmock.h" 25 #include "testing/gmock/include/gmock/gmock.h"
25 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
26 27
27 using ::testing::_; 28 using ::testing::_;
28 using ::testing::AtLeast; 29 using ::testing::AtLeast;
29 using ::testing::AnyNumber; 30 using ::testing::AnyNumber;
30 using ::testing::DoAll; 31 using ::testing::DoAll;
31 using ::testing::InSequence; 32 using ::testing::InSequence;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); 199 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO));
199 200
200 // ResourceContext must be created on the UI thread. 201 // ResourceContext must be created on the UI thread.
201 ui_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, 202 ui_thread_.reset(new BrowserThreadImpl(BrowserThread::UI,
202 message_loop_.get())); 203 message_loop_.get()));
203 204
204 // MediaStreamManager must be created on the IO thread. 205 // MediaStreamManager must be created on the IO thread.
205 io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO, 206 io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO,
206 message_loop_.get())); 207 message_loop_.get()));
207 208
209 audio_manager_ = AudioManager::Create();
210
208 // Create a MediaStreamManager instance and hand over pointer to 211 // Create a MediaStreamManager instance and hand over pointer to
209 // ResourceContext. 212 // ResourceContext.
210 media_stream_manager_.reset(new media_stream::MediaStreamManager()); 213 media_stream_manager_.reset(new media_stream::MediaStreamManager(
214 audio_manager_));
211 215
212 #ifndef TEST_REAL_CAPTURE_DEVICE 216 #ifndef TEST_REAL_CAPTURE_DEVICE
213 media_stream_manager_->UseFakeDevice(); 217 media_stream_manager_->UseFakeDevice();
214 #endif 218 #endif
215 219
216 content::MockResourceContext::GetInstance()->set_media_stream_manager( 220 content::MockResourceContext::GetInstance()->set_media_stream_manager(
217 media_stream_manager_.get()); 221 media_stream_manager_.get());
218 host_ = new MockVideoCaptureHost( 222 host_ = new MockVideoCaptureHost(
219 content::MockResourceContext::GetInstance()); 223 content::MockResourceContext::GetInstance());
220 224
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 SyncWithVideoCaptureManagerThread(); 365 SyncWithVideoCaptureManagerThread();
362 } 366 }
363 367
364 scoped_refptr<MockVideoCaptureHost> host_; 368 scoped_refptr<MockVideoCaptureHost> host_;
365 369
366 private: 370 private:
367 scoped_ptr<MessageLoop> message_loop_; 371 scoped_ptr<MessageLoop> message_loop_;
368 scoped_ptr<BrowserThreadImpl> ui_thread_; 372 scoped_ptr<BrowserThreadImpl> ui_thread_;
369 scoped_ptr<BrowserThreadImpl> io_thread_; 373 scoped_ptr<BrowserThreadImpl> io_thread_;
370 scoped_ptr<media_stream::MediaStreamManager> media_stream_manager_; 374 scoped_ptr<media_stream::MediaStreamManager> media_stream_manager_;
375 scoped_refptr<AudioManager> audio_manager_;
371 376
372 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHostTest); 377 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHostTest);
373 }; 378 };
374 379
375 TEST_F(VideoCaptureHostTest, StartCapture) { 380 TEST_F(VideoCaptureHostTest, StartCapture) {
376 StartCapture(); 381 StartCapture();
377 } 382 }
378 383
379 TEST_F(VideoCaptureHostTest, StartCapturePlayStop) { 384 TEST_F(VideoCaptureHostTest, StartCapturePlayStop) {
380 StartCapture(); 385 StartCapture();
(...skipping 20 matching lines...) Expand all
401 } 406 }
402 407
403 #ifdef DUMP_VIDEO 408 #ifdef DUMP_VIDEO
404 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { 409 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) {
405 CaptureAndDumpVideo(640, 480, 30); 410 CaptureAndDumpVideo(640, 480, 30);
406 } 411 }
407 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { 412 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) {
408 CaptureAndDumpVideo(1280, 720, 30); 413 CaptureAndDumpVideo(1280, 720, 30);
409 } 414 }
410 #endif 415 #endif
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/media_stream_manager.cc ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698