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

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

Issue 2803483003: [Mojo Video Capture] Split interface BuildableVideoCaptureDevice (Closed)
Patch Set: Remove fallback mechanism. 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
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 "content/browser/renderer_host/media/media_stream_dispatcher_host.h" 5 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <memory> 8 #include <memory>
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/callback_helpers.h" 14 #include "base/callback_helpers.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
19 #include "base/system_monitor/system_monitor.h" 19 #include "base/system_monitor/system_monitor.h"
20 #include "base/threading/thread_task_runner_handle.h" 20 #include "base/threading/thread_task_runner_handle.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "content/browser/browser_thread_impl.h" 22 #include "content/browser/browser_thread_impl.h"
23 #include "content/browser/renderer_host/media/audio_input_device_manager.h" 23 #include "content/browser/renderer_host/media/audio_input_device_manager.h"
24 #include "content/browser/renderer_host/media/media_stream_manager.h" 24 #include "content/browser/renderer_host/media/media_stream_manager.h"
25 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" 25 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h"
26 #include "content/browser/renderer_host/media/mock_video_capture_provider.h"
26 #include "content/browser/renderer_host/media/video_capture_manager.h" 27 #include "content/browser/renderer_host/media/video_capture_manager.h"
27 #include "content/common/media/media_stream_messages.h" 28 #include "content/common/media/media_stream_messages.h"
28 #include "content/common/media/media_stream_options.h" 29 #include "content/common/media/media_stream_options.h"
29 #include "content/public/browser/media_device_id.h" 30 #include "content/public/browser/media_device_id.h"
30 #include "content/public/common/content_switches.h" 31 #include "content/public/common/content_switches.h"
31 #include "content/public/test/mock_resource_context.h" 32 #include "content/public/test/mock_resource_context.h"
32 #include "content/public/test/test_browser_context.h" 33 #include "content/public/test/test_browser_context.h"
33 #include "content/public/test/test_browser_thread_bundle.h" 34 #include "content/public/test/test_browser_thread_bundle.h"
34 #include "content/test/test_content_browser_client.h" 35 #include "content/test/test_content_browser_client.h"
35 #include "content/test/test_content_client.h" 36 #include "content/test/test_content_client.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 }; 231 };
231 232
232 class MockMediaStreamUIProxy : public FakeMediaStreamUIProxy { 233 class MockMediaStreamUIProxy : public FakeMediaStreamUIProxy {
233 public: 234 public:
234 MOCK_METHOD2( 235 MOCK_METHOD2(
235 OnStarted, 236 OnStarted,
236 void(const base::Closure& stop, 237 void(const base::Closure& stop,
237 const MediaStreamUIProxy::WindowIdCallback& window_id_callback)); 238 const MediaStreamUIProxy::WindowIdCallback& window_id_callback));
238 }; 239 };
239 240
240 class MockVideoCaptureProvider : public VideoCaptureProvider {
241 public:
242 MOCK_METHOD1(GetDeviceInfosAsync,
243 void(const base::Callback<
244 void(const std::vector<media::VideoCaptureDeviceInfo>&)>&
245 result_callback));
246
247 MOCK_METHOD2(CreateBuildableDevice,
248 std::unique_ptr<BuildableVideoCaptureDevice>(
249 const std::string& device_id,
250 MediaStreamType stream_type));
251 };
252
253 class MediaStreamDispatcherHostTest : public testing::Test { 241 class MediaStreamDispatcherHostTest : public testing::Test {
254 public: 242 public:
255 MediaStreamDispatcherHostTest() 243 MediaStreamDispatcherHostTest()
256 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), 244 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
257 old_browser_client_(NULL), 245 old_browser_client_(NULL),
258 origin_(GURL("https://test.com")) { 246 origin_(GURL("https://test.com")) {
259 audio_manager_.reset( 247 audio_manager_.reset(
260 new media::MockAudioManager(base::ThreadTaskRunnerHandle::Get())); 248 new media::MockAudioManager(base::ThreadTaskRunnerHandle::Get()));
261 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); 249 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get());
262 // Make sure we use fake devices to avoid long delays. 250 // Make sure we use fake devices to avoid long delays.
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 base::RunLoop run_loop; 869 base::RunLoop run_loop;
882 EXPECT_CALL(*host_.get(), OnDeviceStopped(kRenderId)) 870 EXPECT_CALL(*host_.get(), OnDeviceStopped(kRenderId))
883 .WillOnce(testing::InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); 871 .WillOnce(testing::InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
884 media_stream_manager_->media_devices_manager()->OnDevicesChanged( 872 media_stream_manager_->media_devices_manager()->OnDevicesChanged(
885 base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE); 873 base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE);
886 874
887 run_loop.Run(); 875 run_loop.Run();
888 } 876 }
889 877
890 }; // namespace content 878 }; // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698