OLD | NEW |
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 <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/files/scoped_file.h" | 10 #include "base/files/scoped_file.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "content/browser/browser_thread_impl.h" | 16 #include "content/browser/browser_thread_impl.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/media_stream_requester.h" | 18 #include "content/browser/renderer_host/media/media_stream_requester.h" |
19 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" | 19 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" |
20 #include "content/browser/renderer_host/media/video_capture_host.h" | 20 #include "content/browser/renderer_host/media/video_capture_host.h" |
21 #include "content/browser/renderer_host/media/video_capture_manager.h" | 21 #include "content/browser/renderer_host/media/video_capture_manager.h" |
22 #include "content/common/media/video_capture_messages.h" | 22 #include "content/common/media/video_capture_messages.h" |
23 #include "content/public/test/mock_resource_context.h" | 23 #include "content/public/test/mock_resource_context.h" |
24 #include "content/public/test/test_browser_context.h" | 24 #include "content/public/test/test_browser_context.h" |
25 #include "content/public/test/test_browser_thread_bundle.h" | 25 #include "content/public/test/test_browser_thread_bundle.h" |
26 #include "content/test/test_content_browser_client.h" | 26 #include "content/test/test_content_browser_client.h" |
27 #include "media/audio/audio_manager.h" | 27 #include "media/audio/audio_manager.h" |
28 #include "media/base/video_frame.h" | 28 #include "media/base/video_frame.h" |
| 29 #include "media/video/capture/fake_video_capture_device_factory.h" |
29 #include "media/video/capture/video_capture_types.h" | 30 #include "media/video/capture/video_capture_types.h" |
30 #include "net/url_request/url_request_context.h" | 31 #include "net/url_request/url_request_context.h" |
31 #include "testing/gmock/include/gmock/gmock.h" | 32 #include "testing/gmock/include/gmock/gmock.h" |
32 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
33 | 34 |
34 using ::testing::_; | 35 using ::testing::_; |
35 using ::testing::AtLeast; | 36 using ::testing::AtLeast; |
36 using ::testing::AnyNumber; | 37 using ::testing::AnyNumber; |
37 using ::testing::DoAll; | 38 using ::testing::DoAll; |
38 using ::testing::InSequence; | 39 using ::testing::InSequence; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), | 279 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), |
279 message_loop_(base::MessageLoopProxy::current()), | 280 message_loop_(base::MessageLoopProxy::current()), |
280 opened_session_id_(kInvalidMediaCaptureSessionId) {} | 281 opened_session_id_(kInvalidMediaCaptureSessionId) {} |
281 | 282 |
282 virtual void SetUp() OVERRIDE { | 283 virtual void SetUp() OVERRIDE { |
283 SetBrowserClientForTesting(&browser_client_); | 284 SetBrowserClientForTesting(&browser_client_); |
284 // Create our own MediaStreamManager. | 285 // Create our own MediaStreamManager. |
285 audio_manager_.reset(media::AudioManager::CreateForTesting()); | 286 audio_manager_.reset(media::AudioManager::CreateForTesting()); |
286 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get())); | 287 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get())); |
287 #ifndef TEST_REAL_CAPTURE_DEVICE | 288 #ifndef TEST_REAL_CAPTURE_DEVICE |
288 media_stream_manager_->UseFakeDevice(); | 289 media_stream_manager_->UseFakeVideoDevice( |
| 290 scoped_ptr<media::VideoCaptureDeviceFactory>( |
| 291 new media::FakeVideoCaptureDeviceFactory())); |
| 292 media_stream_manager_->UseFakeAudioDevice(); |
289 #endif | 293 #endif |
290 media_stream_manager_->UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy>()); | 294 media_stream_manager_->UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy>()); |
291 | 295 |
292 // Create a Host and connect it to a simulated IPC channel. | 296 // Create a Host and connect it to a simulated IPC channel. |
293 host_ = new MockVideoCaptureHost(media_stream_manager_.get()); | 297 host_ = new MockVideoCaptureHost(media_stream_manager_.get()); |
294 host_->OnChannelConnected(base::GetCurrentProcId()); | 298 host_->OnChannelConnected(base::GetCurrentProcId()); |
295 | 299 |
296 OpenSession(); | 300 OpenSession(); |
297 } | 301 } |
298 | 302 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 #ifdef DUMP_VIDEO | 533 #ifdef DUMP_VIDEO |
530 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { | 534 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { |
531 CaptureAndDumpVideo(640, 480, 30); | 535 CaptureAndDumpVideo(640, 480, 30); |
532 } | 536 } |
533 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { | 537 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { |
534 CaptureAndDumpVideo(1280, 720, 30); | 538 CaptureAndDumpVideo(1280, 720, 30); |
535 } | 539 } |
536 #endif | 540 #endif |
537 | 541 |
538 } // namespace content | 542 } // namespace content |
OLD | NEW |