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

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

Issue 34393006: Refactor MediaStreamManager to never output real device id. It now always output sourceId in the fo… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix broken video_capture_host unittests. Addressed justinlinlins comments. Created 7 years, 1 month 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) 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 <string> 5 #include <string>
6 #include <queue> 6 #include <queue>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "content/browser/browser_thread_impl.h" 12 #include "content/browser/browser_thread_impl.h"
13 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" 13 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h"
14 #include "content/browser/renderer_host/media/media_stream_manager.h" 14 #include "content/browser/renderer_host/media/media_stream_manager.h"
15 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" 15 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h"
16 #include "content/common/media/media_stream_messages.h" 16 #include "content/common/media/media_stream_messages.h"
17 #include "content/common/media/media_stream_options.h" 17 #include "content/common/media/media_stream_options.h"
18 #include "content/public/browser/media_device_id.h"
18 #include "content/public/test/mock_resource_context.h" 19 #include "content/public/test/mock_resource_context.h"
19 #include "content/public/test/test_browser_thread_bundle.h" 20 #include "content/public/test/test_browser_thread_bundle.h"
20 #include "content/test/test_content_browser_client.h" 21 #include "content/test/test_content_browser_client.h"
21 #include "content/test/test_content_client.h" 22 #include "content/test/test_content_client.h"
22 #include "ipc/ipc_message_macros.h" 23 #include "ipc/ipc_message_macros.h"
23 #include "media/audio/audio_manager.h" 24 #include "media/audio/audio_manager.h"
25 #include "media/audio/audio_manager_base.h"
26 #if defined(OS_ANDROID)
27 #include "media/audio/android/audio_manager_android.h"
28 #elif defined(OS_LINUX) || defined(OS_OPENBSD)
29 #include "media/audio/linux/audio_manager_linux.h"
30 #elif defined(OS_MACOSX)
31 #include "media/audio/mac/audio_manager_mac.h"
32 #elif defined(OS_WIN)
33 #include "media/audio/win/audio_manager_win.h"
34 #endif
24 #include "media/video/capture/fake_video_capture_device.h" 35 #include "media/video/capture/fake_video_capture_device.h"
25 #include "net/url_request/url_request_context.h" 36 #include "net/url_request/url_request_context.h"
26 #include "testing/gmock/include/gmock/gmock.h" 37 #include "testing/gmock/include/gmock/gmock.h"
27 #include "testing/gtest/include/gtest/gtest.h" 38 #include "testing/gtest/include/gtest/gtest.h"
28 39
29 using ::testing::_; 40 using ::testing::_;
30 using ::testing::DeleteArg; 41 using ::testing::DeleteArg;
31 using ::testing::DoAll; 42 using ::testing::DoAll;
32 using ::testing::Return; 43 using ::testing::Return;
33 using ::testing::SaveArg; 44 using ::testing::SaveArg;
34 45
35 const int kProcessId = 5; 46 const int kProcessId = 5;
36 const int kRenderId = 6; 47 const int kRenderId = 6;
37 const int kPageRequestId = 7; 48 const int kPageRequestId = 7;
38 49
39 namespace content { 50 namespace content {
40 51
52 #if defined(OS_LINUX) || defined(OS_OPENBSD)
53 typedef media::AudioManagerLinux AudioManagerPlatform;
54 #elif defined(OS_MACOSX)
55 typedef media::AudioManagerMac AudioManagerPlatform;
56 #elif defined(OS_WIN)
57 typedef media::AudioManagerWin AudioManagerPlatform;
58 #elif defined(OS_ANDROID)
59 typedef media::AudioManagerAndroid AudioManagerPlatform;
60 #endif
61
62 // This class mocks the audio manager and overrides the
63 // GetAudioInputDeviceNames() method to ensure that we can run our tests on
64 // the buildbots. media::AudioManagerBase
65 class MockAudioManager : public AudioManagerPlatform {
66 public:
67 MockAudioManager() {}
68 virtual ~MockAudioManager() {}
69
70 virtual void GetAudioInputDeviceNames(
71 media::AudioDeviceNames* device_names) OVERRIDE {
72 DCHECK(device_names->empty());
73 device_names->push_back(media::AudioDeviceName("fake_device_name_1",
74 "fake_device_id_1"));
75 device_names->push_back(media::AudioDeviceName("fake_device_name_2",
76 "fake_device_id_2"));
77 }
78 private:
79 DISALLOW_COPY_AND_ASSIGN(MockAudioManager);
80 };
81
82
41 class MockMediaStreamDispatcherHost : public MediaStreamDispatcherHost, 83 class MockMediaStreamDispatcherHost : public MediaStreamDispatcherHost,
42 public TestContentBrowserClient { 84 public TestContentBrowserClient {
43 public: 85 public:
44 MockMediaStreamDispatcherHost( 86 MockMediaStreamDispatcherHost(
45 const scoped_refptr<base::MessageLoopProxy>& message_loop, 87 const scoped_refptr<base::MessageLoopProxy>& message_loop,
46 MediaStreamManager* manager) 88 MediaStreamManager* manager)
47 : MediaStreamDispatcherHost(kProcessId, manager), 89 : MediaStreamDispatcherHost(kProcessId, manager),
48 message_loop_(message_loop) {} 90 message_loop_(message_loop) {}
49 91
50 // A list of mock methods. 92 // A list of mock methods.
51 MOCK_METHOD4(OnStreamGenerated, 93 MOCK_METHOD4(OnStreamGenerated,
52 void(int routing_id, int request_id, int audio_array_size, 94 void(int routing_id, int request_id, int audio_array_size,
53 int video_array_size)); 95 int video_array_size));
54 MOCK_METHOD2(OnStreamGenerationFailed, void(int routing_id, int request_id)); 96 MOCK_METHOD2(OnStreamGenerationFailed, void(int routing_id, int request_id));
55 MOCK_METHOD1(OnStopGeneratedStreamFromBrowser, 97 MOCK_METHOD1(OnStopGeneratedStreamFromBrowser,
56 void(int routing_id)); 98 void(int routing_id));
57 MOCK_METHOD2(OnDeviceOpened, 99 MOCK_METHOD2(OnDeviceOpened,
58 void(int routing_id, int request_id)); 100 void(int routing_id, int request_id));
59 101
60 // Accessor to private functions. 102 // Accessor to private functions.
61 void OnGenerateStream(int render_view_id, 103 void OnGenerateStream(int render_view_id,
62 int page_request_id, 104 int page_request_id,
63 const StreamOptions& components, 105 const StreamOptions& components,
106 const GURL& security_origin,
64 const base::Closure& quit_closure) { 107 const base::Closure& quit_closure) {
65 quit_closures_.push(quit_closure); 108 quit_closures_.push(quit_closure);
66 MediaStreamDispatcherHost::OnGenerateStream( 109 MediaStreamDispatcherHost::OnGenerateStream(
67 render_view_id, page_request_id, components, GURL()); 110 render_view_id, page_request_id, components, security_origin);
68 } 111 }
69 112
70 void OnStopStreamDevice(int render_view_id, 113 void OnStopStreamDevice(int render_view_id,
71 const std::string& device_id) { 114 const std::string& device_id) {
72 MediaStreamDispatcherHost::OnStopStreamDevice(render_view_id, device_id); 115 MediaStreamDispatcherHost::OnStopStreamDevice(render_view_id, device_id);
73 } 116 }
74 117
75 void OnOpenDevice(int render_view_id, 118 void OnOpenDevice(int render_view_id,
76 int page_request_id, 119 int page_request_id,
77 const std::string& device_id, 120 const std::string& device_id,
78 MediaStreamType type, 121 MediaStreamType type,
122 const GURL& security_origin,
79 const base::Closure& quit_closure) { 123 const base::Closure& quit_closure) {
80 quit_closures_.push(quit_closure); 124 quit_closures_.push(quit_closure);
81 MediaStreamDispatcherHost::OnOpenDevice( 125 MediaStreamDispatcherHost::OnOpenDevice(
82 render_view_id, page_request_id, device_id, type, GURL()); 126 render_view_id, page_request_id, device_id, type, security_origin);
83 } 127 }
84 128
85 bool FindExistingRequestedDeviceInfo(const std::string& device_id, 129 void OnEnumerateDevices(int render_view_id,
86 MediaStreamRequestType request_type, 130 int page_request_id,
87 StreamDeviceInfo* device_info) { 131 MediaStreamType type,
88 MediaRequestState request_state; 132 const GURL& security_origin,
89 return media_stream_manager_->FindExistingRequestedDeviceInfo( 133 const base::Closure& quit_closure) {
90 kProcessId, kRenderId, request_type, device_id, device_info, 134 quit_closures_.push(quit_closure);
91 &request_state); 135 MediaStreamDispatcherHost::OnEnumerateDevices(
136 render_view_id, page_request_id, type, security_origin);
92 } 137 }
93 138
94 std::string label_; 139 std::string label_;
95 StreamDeviceInfoArray audio_devices_; 140 StreamDeviceInfoArray audio_devices_;
96 StreamDeviceInfoArray video_devices_; 141 StreamDeviceInfoArray video_devices_;
97 StreamDeviceInfo opened_device_; 142 StreamDeviceInfo opened_device_;
143 StreamDeviceInfoArray enumerated_devices_;
98 144
99 private: 145 private:
100 virtual ~MockMediaStreamDispatcherHost() {} 146 virtual ~MockMediaStreamDispatcherHost() {}
101 147
102 // This method is used to dispatch IPC messages to the renderer. We intercept 148 // This method is used to dispatch IPC messages to the renderer. We intercept
103 // these messages here and dispatch to our mock methods to verify the 149 // these messages here and dispatch to our mock methods to verify the
104 // conversation between this object and the renderer. 150 // conversation between this object and the renderer.
105 virtual bool Send(IPC::Message* message) OVERRIDE { 151 virtual bool Send(IPC::Message* message) OVERRIDE {
106 CHECK(message); 152 CHECK(message);
107 153
108 // In this method we dispatch the messages to the according handlers as if 154 // In this method we dispatch the messages to the according handlers as if
109 // we are the renderer. 155 // we are the renderer.
110 bool handled = true; 156 bool handled = true;
111 IPC_BEGIN_MESSAGE_MAP(MockMediaStreamDispatcherHost, *message) 157 IPC_BEGIN_MESSAGE_MAP(MockMediaStreamDispatcherHost, *message)
112 IPC_MESSAGE_HANDLER(MediaStreamMsg_StreamGenerated, OnStreamGenerated) 158 IPC_MESSAGE_HANDLER(MediaStreamMsg_StreamGenerated, OnStreamGenerated)
113 IPC_MESSAGE_HANDLER(MediaStreamMsg_StreamGenerationFailed, 159 IPC_MESSAGE_HANDLER(MediaStreamMsg_StreamGenerationFailed,
114 OnStreamGenerationFailed) 160 OnStreamGenerationFailed)
115 IPC_MESSAGE_HANDLER(MediaStreamMsg_StopGeneratedStream, 161 IPC_MESSAGE_HANDLER(MediaStreamMsg_StopGeneratedStream,
116 OnStopGeneratedStreamFromBrowser) 162 OnStopGeneratedStreamFromBrowser)
117 IPC_MESSAGE_HANDLER(MediaStreamMsg_DeviceOpened, OnDeviceOpened) 163 IPC_MESSAGE_HANDLER(MediaStreamMsg_DeviceOpened, OnDeviceOpened)
164 IPC_MESSAGE_HANDLER(MediaStreamMsg_DevicesEnumerated,
165 OnDevicesEnumerated)
118 IPC_MESSAGE_UNHANDLED(handled = false) 166 IPC_MESSAGE_UNHANDLED(handled = false)
119 IPC_END_MESSAGE_MAP() 167 IPC_END_MESSAGE_MAP()
120 EXPECT_TRUE(handled); 168 EXPECT_TRUE(handled);
121 169
122 delete message; 170 delete message;
123 return true; 171 return true;
124 } 172 }
125 173
126 // These handler methods do minimal things and delegate to the mock methods. 174 // These handler methods do minimal things and delegate to the mock methods.
127 void OnStreamGenerated( 175 void OnStreamGenerated(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 int request_id, 217 int request_id,
170 const std::string& label, 218 const std::string& label,
171 const StreamDeviceInfo& device) { 219 const StreamDeviceInfo& device) {
172 base::Closure quit_closure = quit_closures_.front(); 220 base::Closure quit_closure = quit_closures_.front();
173 quit_closures_.pop(); 221 quit_closures_.pop();
174 message_loop_->PostTask(FROM_HERE, base::ResetAndReturn(&quit_closure)); 222 message_loop_->PostTask(FROM_HERE, base::ResetAndReturn(&quit_closure));
175 label_ = label; 223 label_ = label;
176 opened_device_ = device; 224 opened_device_ = device;
177 } 225 }
178 226
227 void OnDevicesEnumerated(const IPC::Message& msg,
228 int request_id,
229 const std::string& label,
230 const StreamDeviceInfoArray& devices) {
231 base::Closure quit_closure = quit_closures_.front();
232 quit_closures_.pop();
233 message_loop_->PostTask(FROM_HERE, base::ResetAndReturn(&quit_closure));
234 label_ = label;
235 enumerated_devices_ = devices;
236 }
237
179 scoped_refptr<base::MessageLoopProxy> message_loop_; 238 scoped_refptr<base::MessageLoopProxy> message_loop_;
180 239
181 std::queue<base::Closure> quit_closures_; 240 std::queue<base::Closure> quit_closures_;
182 }; 241 };
183 242
184 class MockMediaStreamUIProxy : public FakeMediaStreamUIProxy { 243 class MockMediaStreamUIProxy : public FakeMediaStreamUIProxy {
185 public: 244 public:
186 MOCK_METHOD1(OnStarted, void(const base::Closure& stop)); 245 MOCK_METHOD1(OnStarted, void(const base::Closure& stop));
187 }; 246 };
188 247
189 class MediaStreamDispatcherHostTest : public testing::Test { 248 class MediaStreamDispatcherHostTest : public testing::Test {
190 public: 249 public:
191 MediaStreamDispatcherHostTest() 250 MediaStreamDispatcherHostTest()
192 : old_browser_client_(NULL), 251 : old_browser_client_(NULL),
193 thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { 252 thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
253 origin_("https://test.com") {
194 // Create our own MediaStreamManager. 254 // Create our own MediaStreamManager.
195 audio_manager_.reset(media::AudioManager::Create()); 255 audio_manager_.reset(new MockAudioManager());
196 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get())); 256 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get()));
197 // Make sure we use fake devices to avoid long delays. 257 // Make sure we use fake devices to avoid long delays.
198 media_stream_manager_->UseFakeDevice(); 258 media_stream_manager_->UseFakeDevice();
199 259
200 host_ = new MockMediaStreamDispatcherHost(base::MessageLoopProxy::current(), 260 host_ = new MockMediaStreamDispatcherHost(base::MessageLoopProxy::current(),
201 media_stream_manager_.get()); 261 media_stream_manager_.get());
202 262
203 // Use the fake content client and browser. 263 // Use the fake content client and browser.
204 content_client_.reset(new TestContentClient()); 264 content_client_.reset(new TestContentClient());
205 SetContentClient(content_client_.get()); 265 SetContentClient(content_client_.get());
206 old_browser_client_ = SetBrowserClientForTesting(host_.get()); 266 old_browser_client_ = SetBrowserClientForTesting(host_.get());
207 } 267 }
208 268
209 virtual ~MediaStreamDispatcherHostTest() { 269 virtual ~MediaStreamDispatcherHostTest() {
210 // Recover the old browser client and content client. 270 }
211 SetBrowserClientForTesting(old_browser_client_); 271
212 content_client_.reset(); 272 virtual void SetUp() OVERRIDE {
213 media_stream_manager_->WillDestroyCurrentMessageLoop(); 273 media::FakeVideoCaptureDevice::GetDeviceNames(&physical_video_devices_);
274 ASSERT_GT(physical_video_devices_.size(), 0u);
275
276 audio_manager_->GetAudioInputDeviceNames(&physical_audio_devices_);
277 ASSERT_GT(physical_audio_devices_.size(), 0u);
214 } 278 }
215 279
216 virtual void TearDown() OVERRIDE { 280 virtual void TearDown() OVERRIDE {
217 host_->OnChannelClosing(); 281 host_->OnChannelClosing();
218 } 282 }
219 283
220 protected: 284 protected:
221 virtual void SetupFakeUI(bool expect_started) { 285 virtual void SetupFakeUI(bool expect_started) {
222 scoped_ptr<MockMediaStreamUIProxy> stream_ui(new MockMediaStreamUIProxy()); 286 scoped_ptr<MockMediaStreamUIProxy> stream_ui(new MockMediaStreamUIProxy());
223 if (expect_started) { 287 if (expect_started) {
224 EXPECT_CALL(*stream_ui, OnStarted(_)); 288 EXPECT_CALL(*stream_ui, OnStarted(_));
225 } 289 }
226 media_stream_manager_->UseFakeUI( 290 media_stream_manager_->UseFakeUI(
227 stream_ui.PassAs<FakeMediaStreamUIProxy>()); 291 stream_ui.PassAs<FakeMediaStreamUIProxy>());
228 } 292 }
229 293
230 void GenerateStreamAndWaitForResult(int render_view_id, 294 void GenerateStreamAndWaitForResult(int render_view_id,
231 int page_request_id, 295 int page_request_id,
232 const StreamOptions& options) { 296 const StreamOptions& options) {
233 base::RunLoop run_loop; 297 base::RunLoop run_loop;
234 host_->OnGenerateStream(render_view_id, page_request_id, options, 298 EXPECT_CALL(*host_.get(), OnStreamGenerated(
299 render_view_id, page_request_id,
300 options.audio_type != MEDIA_NO_SERVICE ? 1 : 0,
301 options.video_type != MEDIA_NO_SERVICE ? 1 : 0));
302 host_->OnGenerateStream(render_view_id, page_request_id, options, origin_,
235 run_loop.QuitClosure()); 303 run_loop.QuitClosure());
236 run_loop.Run(); 304 run_loop.Run();
305 EXPECT_FALSE(DoesContainRawIds(host_->audio_devices_));
306 EXPECT_FALSE(DoesContainRawIds(host_->video_devices_));
307 EXPECT_TRUE(DoesEveryDeviceMapToRawId(host_->audio_devices_, origin_));
308 EXPECT_TRUE(DoesEveryDeviceMapToRawId(host_->video_devices_, origin_));
309 }
310
311 void GenerateStreamAndWaitForFailure(int render_view_id,
312 int page_request_id,
313 const StreamOptions& options) {
314 base::RunLoop run_loop;
315 EXPECT_CALL(*host_.get(),
316 OnStreamGenerationFailed(render_view_id, page_request_id));
317 host_->OnGenerateStream(render_view_id, page_request_id, options, origin_,
318 run_loop.QuitClosure());
319 run_loop.Run();
237 } 320 }
238 321
239 void OpenVideoDeviceAndWaitForResult(int render_view_id, 322 void OpenVideoDeviceAndWaitForResult(int render_view_id,
240 int page_request_id, 323 int page_request_id,
241 const std::string& device_id) { 324 const std::string& device_id) {
242 base::RunLoop run_loop; 325 base::RunLoop run_loop;
243 host_->OnOpenDevice(render_view_id, page_request_id, device_id, 326 host_->OnOpenDevice(render_view_id, page_request_id, device_id,
244 MEDIA_DEVICE_VIDEO_CAPTURE, 327 MEDIA_DEVICE_VIDEO_CAPTURE, origin_,
245 run_loop.QuitClosure()); 328 run_loop.QuitClosure());
246 run_loop.Run(); 329 run_loop.Run();
330 EXPECT_FALSE(DoesContainRawIds(host_->video_devices_));
331 EXPECT_TRUE(DoesEveryDeviceMapToRawId(host_->video_devices_, origin_));
332 }
333
334 void StopStreamDeviceAndWait(const std::string& device_id) {
335 EXPECT_TRUE(FindRequestedDeviceInfo(device_id, MEDIA_GENERATE_STREAM,
336 NULL));
337 host_->OnStopStreamDevice(kRenderId, device_id);
338 base::RunLoop().RunUntilIdle();
339 EXPECT_FALSE(FindRequestedDeviceInfo(device_id, MEDIA_GENERATE_STREAM,
340 NULL));
341 }
342
343 void EnumerateDevicesAndWaitForResult(int render_view_id,
344 int page_request_id,
345 MediaStreamType type) {
346 base::RunLoop run_loop;
347 host_->OnEnumerateDevices(render_view_id, page_request_id, type, origin_,
348 run_loop.QuitClosure());
349 run_loop.Run();
350 ASSERT_FALSE(host_->enumerated_devices_.empty());
351 EXPECT_FALSE(DoesContainRawIds(host_->enumerated_devices_));
352 EXPECT_TRUE(DoesEveryDeviceMapToRawId(host_->enumerated_devices_, origin_));
353 }
354
355 bool FindRequestedDeviceInfo(const std::string& device_id,
356 MediaStreamRequestType request_type,
357 StreamDeviceInfo* device_info) {
358 return media_stream_manager_->FindRequestedDeviceInfo(device_id,
359 kProcessId,
360 kRenderId,
361 request_type,
362 device_info);
363 }
364
365 bool DoesContainRawIds(const StreamDeviceInfoArray& devices) {
366 for (size_t i = 0; i < devices.size(); i++) {
tommi (sloooow) - chröme 2013/10/28 13:48:23 nit: change i++ to ++i (elsewhere as well)
perkj_chrome 2013/10/29 08:52:17 Done.
367 media::AudioDeviceNames::const_iterator audio_it =
368 physical_audio_devices_.begin();
369 for (; audio_it != physical_audio_devices_.end(); ++audio_it) {
370 if (audio_it->unique_id == devices[i].device.id)
371 return true;
372 }
373 media::VideoCaptureDevice::Names::const_iterator video_it =
374 physical_video_devices_.begin();
375 for (; video_it != physical_video_devices_.end(); ++video_it) {
376 if (video_it->id() == devices[i].device.id)
377 return true;
378 }
379 }
380 return false;
381 }
382
383 bool DoesEveryDeviceMapToRawId(const StreamDeviceInfoArray& devices,
384 const GURL& origin) {
385 for (size_t i = 0; i < devices.size(); i++) {
386 bool found_match = false;
387 media::AudioDeviceNames::const_iterator audio_it =
388 physical_audio_devices_.begin();
389 for (; audio_it != physical_audio_devices_.end(); ++audio_it) {
390 if (content::DoesMediaDeviceIDMatchHMAC(
391 origin,
392 devices[i].device.id,
393 audio_it->unique_id)) {
394 EXPECT_FALSE(found_match);
395 found_match = true;
396 }
397 }
398 media::VideoCaptureDevice::Names::const_iterator video_it =
399 physical_video_devices_.begin();
400 for (; video_it != physical_video_devices_.end(); ++video_it) {
401 if (content::DoesMediaDeviceIDMatchHMAC(
402 origin,
403 devices[i].device.id,
404 video_it->id())) {
405 EXPECT_FALSE(found_match);
406 found_match = true;
407 }
408 }
409 if (!found_match)
410 return false;
411 }
412 return true;
247 } 413 }
248 414
249 scoped_refptr<MockMediaStreamDispatcherHost> host_; 415 scoped_refptr<MockMediaStreamDispatcherHost> host_;
250 scoped_ptr<media::AudioManager> audio_manager_; 416 scoped_ptr<media::AudioManager> audio_manager_;
251 scoped_ptr<MediaStreamManager> media_stream_manager_; 417 scoped_ptr<MediaStreamManager> media_stream_manager_;
252 ContentBrowserClient* old_browser_client_; 418 ContentBrowserClient* old_browser_client_;
253 scoped_ptr<ContentClient> content_client_; 419 scoped_ptr<ContentClient> content_client_;
254 content::TestBrowserThreadBundle thread_bundle_; 420 content::TestBrowserThreadBundle thread_bundle_;
421 media::AudioDeviceNames physical_audio_devices_;
422 media::VideoCaptureDevice::Names physical_video_devices_;
423 GURL origin_;
255 }; 424 };
256 425
257 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithVideoOnly) { 426 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithVideoOnly) {
258 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE); 427 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE);
259 428
260 SetupFakeUI(true); 429 SetupFakeUI(true);
261 EXPECT_CALL(*host_.get(), OnStreamGenerated(kRenderId, kPageRequestId, 0, 1));
262 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options); 430 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options);
263 431
264 EXPECT_EQ(host_->audio_devices_.size(), 0u); 432 EXPECT_EQ(host_->audio_devices_.size(), 0u);
265 EXPECT_EQ(host_->video_devices_.size(), 1u); 433 EXPECT_EQ(host_->video_devices_.size(), 1u);
266 } 434 }
267 435
436 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithAudioOnly) {
437 StreamOptions options(MEDIA_DEVICE_AUDIO_CAPTURE, MEDIA_NO_SERVICE);
438
439 SetupFakeUI(true);
440 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options);
441
442 EXPECT_EQ(host_->audio_devices_.size(), 1u);
443 EXPECT_EQ(host_->video_devices_.size(), 0u);
444 }
445
268 // This test generates two streams with video only using the same render view 446 // This test generates two streams with video only using the same render view
269 // id. The same capture device with the same device and session id is expected 447 // id. The same capture device with the same device and session id is expected
270 // to be used. 448 // to be used.
271 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsFromSameRenderId) { 449 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsFromSameRenderId) {
272 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE); 450 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE);
273 451
274 // Generate first stream. 452 // Generate first stream.
275 SetupFakeUI(true); 453 SetupFakeUI(true);
276 EXPECT_CALL(*host_.get(), OnStreamGenerated(kRenderId, kPageRequestId, 0, 1));
277 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options); 454 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options);
278 455
279 // Check the latest generated stream. 456 // Check the latest generated stream.
280 EXPECT_EQ(host_->audio_devices_.size(), 0u); 457 EXPECT_EQ(host_->audio_devices_.size(), 0u);
281 EXPECT_EQ(host_->video_devices_.size(), 1u); 458 EXPECT_EQ(host_->video_devices_.size(), 1u);
282 const std::string label1 = host_->label_; 459 const std::string label1 = host_->label_;
283 const std::string device_id1 = host_->video_devices_.front().device.id; 460 const std::string device_id1 = host_->video_devices_.front().device.id;
284 const int session_id1 = host_->video_devices_.front().session_id; 461 const int session_id1 = host_->video_devices_.front().session_id;
285 462
286 // Generate second stream. 463 // Generate second stream.
287 SetupFakeUI(true); 464 SetupFakeUI(true);
288 EXPECT_CALL(*host_.get(),
289 OnStreamGenerated(kRenderId, kPageRequestId + 1, 0, 1));
290 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId + 1, options); 465 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId + 1, options);
291 466
292 // Check the latest generated stream. 467 // Check the latest generated stream.
293 EXPECT_EQ(host_->audio_devices_.size(), 0u); 468 EXPECT_EQ(host_->audio_devices_.size(), 0u);
294 EXPECT_EQ(host_->video_devices_.size(), 1u); 469 EXPECT_EQ(host_->video_devices_.size(), 1u);
295 const std::string label2 = host_->label_; 470 const std::string label2 = host_->label_;
296 const std::string device_id2 = host_->video_devices_.front().device.id; 471 const std::string device_id2 = host_->video_devices_.front().device.id;
297 int session_id2 = host_->video_devices_.front().session_id; 472 int session_id2 = host_->video_devices_.front().session_id;
298 EXPECT_EQ(device_id1, device_id2); 473 EXPECT_EQ(device_id1, device_id2);
299 EXPECT_EQ(session_id1, session_id2); 474 EXPECT_EQ(session_id1, session_id2);
300 EXPECT_NE(label1, label2); 475 EXPECT_NE(label1, label2);
301 } 476 }
302 477
303 TEST_F(MediaStreamDispatcherHostTest, 478 TEST_F(MediaStreamDispatcherHostTest,
304 GenerateStreamAndOpenDeviceFromSameRenderId) { 479 GenerateStreamAndOpenDeviceFromSameRenderId) {
305 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE); 480 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE);
306 481
307 // Generate first stream. 482 // Generate first stream.
308 SetupFakeUI(true); 483 SetupFakeUI(true);
309 EXPECT_CALL(*host_.get(), OnStreamGenerated(kRenderId, kPageRequestId, 0, 1));
310 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options); 484 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options);
311 485
312 EXPECT_EQ(host_->audio_devices_.size(), 0u); 486 EXPECT_EQ(host_->audio_devices_.size(), 0u);
313 EXPECT_EQ(host_->video_devices_.size(), 1u); 487 EXPECT_EQ(host_->video_devices_.size(), 1u);
314 const std::string label1 = host_->label_; 488 const std::string label1 = host_->label_;
315 const std::string device_id1 = host_->video_devices_.front().device.id; 489 const std::string device_id1 = host_->video_devices_.front().device.id;
316 const int session_id1 = host_->video_devices_.front().session_id; 490 const int session_id1 = host_->video_devices_.front().session_id;
317 491
318 // Generate second stream. 492 // Generate second stream.
319 OpenVideoDeviceAndWaitForResult(kRenderId, kPageRequestId, device_id1); 493 OpenVideoDeviceAndWaitForResult(kRenderId, kPageRequestId, device_id1);
320 494
321 const std::string device_id2 = host_->opened_device_.device.id; 495 const std::string device_id2 = host_->opened_device_.device.id;
322 const int session_id2 = host_->opened_device_.session_id; 496 const int session_id2 = host_->opened_device_.session_id;
323 const std::string label2 = host_->label_; 497 const std::string label2 = host_->label_;
324 498
325 EXPECT_EQ(device_id1, device_id2); 499 EXPECT_EQ(device_id1, device_id2);
326 EXPECT_NE(session_id1, session_id2); 500 EXPECT_NE(session_id1, session_id2);
327 EXPECT_NE(label1, label2); 501 EXPECT_NE(label1, label2);
328 } 502 }
329 503
330 504
331 // This test generates two streams with video only using two separate render 505 // This test generates two streams with video only using two separate render
332 // view ids. The same device id but different session ids are expected. 506 // view ids. The same device id but different session ids are expected.
333 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsDifferentRenderId) { 507 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsDifferentRenderId) {
334 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE); 508 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE);
335 509
336 // Generate first stream. 510 // Generate first stream.
337 SetupFakeUI(true); 511 SetupFakeUI(true);
338 EXPECT_CALL(*host_.get(), OnStreamGenerated(kRenderId, kPageRequestId, 0, 1));
339 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options); 512 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options);
340 513
341 // Check the latest generated stream. 514 // Check the latest generated stream.
342 EXPECT_EQ(host_->audio_devices_.size(), 0u); 515 EXPECT_EQ(host_->audio_devices_.size(), 0u);
343 EXPECT_EQ(host_->video_devices_.size(), 1u); 516 EXPECT_EQ(host_->video_devices_.size(), 1u);
344 const std::string label1 = host_->label_; 517 const std::string label1 = host_->label_;
345 const std::string device_id1 = host_->video_devices_.front().device.id; 518 const std::string device_id1 = host_->video_devices_.front().device.id;
346 const int session_id1 = host_->video_devices_.front().session_id; 519 const int session_id1 = host_->video_devices_.front().session_id;
347 520
348 // Generate second stream from another render view. 521 // Generate second stream from another render view.
349 SetupFakeUI(true); 522 SetupFakeUI(true);
350 EXPECT_CALL(*host_.get(),
351 OnStreamGenerated(kRenderId+1, kPageRequestId + 1, 0, 1));
352 GenerateStreamAndWaitForResult(kRenderId+1, kPageRequestId + 1, options); 523 GenerateStreamAndWaitForResult(kRenderId+1, kPageRequestId + 1, options);
353 524
354 // Check the latest generated stream. 525 // Check the latest generated stream.
355 EXPECT_EQ(host_->audio_devices_.size(), 0u); 526 EXPECT_EQ(host_->audio_devices_.size(), 0u);
356 EXPECT_EQ(host_->video_devices_.size(), 1u); 527 EXPECT_EQ(host_->video_devices_.size(), 1u);
357 const std::string label2 = host_->label_; 528 const std::string label2 = host_->label_;
358 const std::string device_id2 = host_->video_devices_.front().device.id; 529 const std::string device_id2 = host_->video_devices_.front().device.id;
359 const int session_id2 = host_->video_devices_.front().session_id; 530 const int session_id2 = host_->video_devices_.front().session_id;
360 EXPECT_EQ(device_id1, device_id2); 531 EXPECT_EQ(device_id1, device_id2);
361 EXPECT_NE(session_id1, session_id2); 532 EXPECT_NE(session_id1, session_id2);
362 EXPECT_NE(label1, label2); 533 EXPECT_NE(label1, label2);
363 } 534 }
364 535
365 // This test request two streams with video only without waiting for the first 536 // This test request two streams with video only without waiting for the first
366 // stream to be generated before requesting the second. 537 // stream to be generated before requesting the second.
367 // The same device id and session ids are expected. 538 // The same device id and session ids are expected.
368 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithoutWaiting) { 539 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithoutWaiting) {
369 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE); 540 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE);
370 541
371 // Generate first stream. 542 // Generate first stream.
372 SetupFakeUI(true); 543 SetupFakeUI(true);
373 EXPECT_CALL(*host_.get(), OnStreamGenerated(kRenderId, kPageRequestId, 0, 1)); 544 EXPECT_CALL(*host_.get(), OnStreamGenerated(kRenderId, kPageRequestId, 0, 1));
374 545
375 // Generate second stream. 546 // Generate second stream.
376 EXPECT_CALL(*host_.get(), 547 EXPECT_CALL(*host_.get(),
377 OnStreamGenerated(kRenderId, kPageRequestId + 1, 0, 1)); 548 OnStreamGenerated(kRenderId, kPageRequestId + 1, 0, 1));
378 549
379 base::RunLoop run_loop1; 550 base::RunLoop run_loop1;
380 base::RunLoop run_loop2; 551 base::RunLoop run_loop2;
381 host_->OnGenerateStream(kRenderId, kPageRequestId, options, 552 host_->OnGenerateStream(kRenderId, kPageRequestId, options, origin_,
382 run_loop1.QuitClosure()); 553 run_loop1.QuitClosure());
383 host_->OnGenerateStream(kRenderId, kPageRequestId + 1, options, 554 host_->OnGenerateStream(kRenderId, kPageRequestId + 1, options, origin_,
384 run_loop2.QuitClosure()); 555 run_loop2.QuitClosure());
385 556
386 run_loop1.Run(); 557 run_loop1.Run();
387 run_loop2.Run(); 558 run_loop2.Run();
388 } 559 }
389 560
561 // Test that we can generate streams where a sourceId is specified in the
562 // request.
563 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithSourceId) {
564 ASSERT_GE(physical_audio_devices_.size(), 1u);
565 ASSERT_GE(physical_video_devices_.size(), 1u);
566
567 media::AudioDeviceNames::const_iterator audio_it =
568 physical_audio_devices_.begin();
569 for (; audio_it != physical_audio_devices_.end(); ++audio_it) {
570 StreamOptions options(MEDIA_DEVICE_AUDIO_CAPTURE,
571 MEDIA_DEVICE_VIDEO_CAPTURE);
572 options.audio_device_id = content::GetHMACForMediaDeviceID(
573 origin_,
574 audio_it->unique_id);
575 ASSERT_FALSE(options.audio_device_id.empty());
576
577 // Generate first stream.
578 SetupFakeUI(true);
579 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options);
580 EXPECT_EQ(host_->audio_devices_[0].device.id, options.audio_device_id);
581 }
582
583 media::VideoCaptureDevice::Names::const_iterator video_it =
584 physical_video_devices_.begin();
585 for (; video_it != physical_video_devices_.end(); ++video_it) {
586 StreamOptions options(MEDIA_DEVICE_AUDIO_CAPTURE,
587 MEDIA_DEVICE_VIDEO_CAPTURE);
588 options.video_device_id = content::GetHMACForMediaDeviceID(
589 origin_,
590 video_it->id());
591 ASSERT_FALSE(options.video_device_id.empty());
592
593 // Generate first stream.
594 SetupFakeUI(true);
595 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options);
596 EXPECT_EQ(host_->video_devices_[0].device.id, options.video_device_id);
597 }
598 }
599
600 // Test that generating a stream with an invalid video source id fail.
601 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithInvalidVideoSourceId) {
602 StreamOptions options(MEDIA_DEVICE_AUDIO_CAPTURE,
603 MEDIA_DEVICE_VIDEO_CAPTURE);
604 std::string invalid_source_id = "invalid source id";
605 options.video_device_id = invalid_source_id;
606
607 GenerateStreamAndWaitForFailure(kRenderId, kRenderId, options);
608 }
609
610 // Test that generating a stream with an invalid audio source id fail.
611 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithInvalidAudioSourceId) {
612 StreamOptions options(MEDIA_DEVICE_AUDIO_CAPTURE,
613 MEDIA_DEVICE_VIDEO_CAPTURE);
614 std::string invalid_source_id = "invalid source id";
615 options.audio_device_id = invalid_source_id;
616
617 GenerateStreamAndWaitForFailure(kRenderId, kRenderId, options);
618 }
619
390 TEST_F(MediaStreamDispatcherHostTest, StopDeviceInStream) { 620 TEST_F(MediaStreamDispatcherHostTest, StopDeviceInStream) {
391 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE); 621 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE);
392 622
393 SetupFakeUI(true); 623 SetupFakeUI(true);
394 EXPECT_CALL(*host_.get(), OnStreamGenerated(kRenderId, kPageRequestId, 0, 1));
395 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options); 624 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options);
396 625
397 const std::string device_id = host_->video_devices_.front().device.id; 626 const std::string device_id = host_->video_devices_.front().device.id;
398 const int session_id = host_->video_devices_.front().session_id; 627 const int session_id = host_->video_devices_.front().session_id;
399 StreamDeviceInfo video_device_info; 628 StreamDeviceInfo video_device_info;
400 EXPECT_TRUE(host_->FindExistingRequestedDeviceInfo(device_id, 629 EXPECT_TRUE(FindRequestedDeviceInfo(device_id, MEDIA_GENERATE_STREAM,
401 MEDIA_GENERATE_STREAM, 630 &video_device_info));
402 &video_device_info));
403 EXPECT_EQ(video_device_info.device.id, device_id); 631 EXPECT_EQ(video_device_info.device.id, device_id);
404 EXPECT_EQ(video_device_info.session_id, session_id); 632 EXPECT_EQ(video_device_info.session_id, session_id);
405 633
406 OpenVideoDeviceAndWaitForResult(kRenderId, kPageRequestId, device_id); 634 OpenVideoDeviceAndWaitForResult(kRenderId, kPageRequestId, device_id);
407 635
408 host_->OnStopStreamDevice(kRenderId, device_id); 636 StopStreamDeviceAndWait(device_id);
409 637
410 EXPECT_FALSE(host_->FindExistingRequestedDeviceInfo(device_id, 638 EXPECT_TRUE(FindRequestedDeviceInfo(device_id, MEDIA_OPEN_DEVICE, NULL));
411 MEDIA_GENERATE_STREAM,
412 &video_device_info));
413 EXPECT_TRUE(host_->FindExistingRequestedDeviceInfo(device_id,
414 MEDIA_OPEN_DEVICE,
415 &video_device_info));
416 } 639 }
417 640
418 TEST_F(MediaStreamDispatcherHostTest, CancelPendingStreamsOnChannelClosing) { 641 TEST_F(MediaStreamDispatcherHostTest, CancelPendingStreamsOnChannelClosing) {
419 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE); 642 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE);
420 643
421 base::RunLoop run_loop; 644 base::RunLoop run_loop;
422 645
423 // Create multiple GenerateStream requests. 646 // Create multiple GenerateStream requests.
424 size_t streams = 5; 647 size_t streams = 5;
425 for (size_t i = 1; i <= streams; ++i) { 648 for (size_t i = 1; i <= streams; ++i) {
426 host_->OnGenerateStream(kRenderId, kPageRequestId + i, options, 649 host_->OnGenerateStream(kRenderId, kPageRequestId + i, options, origin_,
427 run_loop.QuitClosure()); 650 run_loop.QuitClosure());
428 } 651 }
429 652
430 // Calling OnChannelClosing() to cancel all the pending requests. 653 // Calling OnChannelClosing() to cancel all the pending requests.
431 host_->OnChannelClosing(); 654 host_->OnChannelClosing();
432 run_loop.RunUntilIdle(); 655 run_loop.RunUntilIdle();
433 } 656 }
434 657
435 TEST_F(MediaStreamDispatcherHostTest, StopGeneratedStreamsOnChannelClosing) { 658 TEST_F(MediaStreamDispatcherHostTest, StopGeneratedStreamsOnChannelClosing) {
436 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE); 659 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE);
437 660
438 // Create first group of streams. 661 // Create first group of streams.
439 size_t generated_streams = 3; 662 size_t generated_streams = 3;
440 for (size_t i = 0; i < generated_streams; ++i) { 663 for (size_t i = 0; i < generated_streams; ++i) {
441 SetupFakeUI(true); 664 SetupFakeUI(true);
442 EXPECT_CALL(*host_.get(),
443 OnStreamGenerated(kRenderId, kPageRequestId + i, 0, 1));
444 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId + i, options); 665 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId + i, options);
445 } 666 }
446 667
447 // Calling OnChannelClosing() to cancel all the pending/generated streams. 668 // Calling OnChannelClosing() to cancel all the pending/generated streams.
448 host_->OnChannelClosing(); 669 host_->OnChannelClosing();
449 base::RunLoop().RunUntilIdle(); 670 base::RunLoop().RunUntilIdle();
450 } 671 }
451 672
452 TEST_F(MediaStreamDispatcherHostTest, CloseFromUI) { 673 TEST_F(MediaStreamDispatcherHostTest, CloseFromUI) {
453 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE); 674 StreamOptions options(MEDIA_NO_SERVICE, MEDIA_DEVICE_VIDEO_CAPTURE);
454 675
455 base::Closure close_callback; 676 base::Closure close_callback;
456 scoped_ptr<MockMediaStreamUIProxy> stream_ui(new MockMediaStreamUIProxy()); 677 scoped_ptr<MockMediaStreamUIProxy> stream_ui(new MockMediaStreamUIProxy());
457 EXPECT_CALL(*stream_ui, OnStarted(_)) 678 EXPECT_CALL(*stream_ui, OnStarted(_))
458 .WillOnce(SaveArg<0>(&close_callback)); 679 .WillOnce(SaveArg<0>(&close_callback));
459 media_stream_manager_->UseFakeUI(stream_ui.PassAs<FakeMediaStreamUIProxy>()); 680 media_stream_manager_->UseFakeUI(stream_ui.PassAs<FakeMediaStreamUIProxy>());
460 681
461 EXPECT_CALL(*host_.get(), OnStreamGenerated(kRenderId, kPageRequestId, 0, 1)); 682 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options);
462 EXPECT_CALL(*host_.get(), OnStopGeneratedStreamFromBrowser(kRenderId)); 683 EXPECT_CALL(*host_.get(), OnStopGeneratedStreamFromBrowser(kRenderId));
463 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options);
464 684
465 EXPECT_EQ(host_->audio_devices_.size(), 0u); 685 EXPECT_EQ(host_->audio_devices_.size(), 0u);
466 EXPECT_EQ(host_->video_devices_.size(), 1u); 686 EXPECT_EQ(host_->video_devices_.size(), 1u);
467 687
468 ASSERT_FALSE(close_callback.is_null()); 688 ASSERT_FALSE(close_callback.is_null());
469 close_callback.Run(); 689 close_callback.Run();
470 base::RunLoop().RunUntilIdle(); 690 base::RunLoop().RunUntilIdle();
471 } 691 }
472 692
693 TEST_F(MediaStreamDispatcherHostTest, EnumerateAudioDevices) {
694 EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId,
695 MEDIA_DEVICE_AUDIO_CAPTURE);
696 }
697
698 TEST_F(MediaStreamDispatcherHostTest, EnumerateVideoDevices) {
699 EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId,
700 MEDIA_DEVICE_VIDEO_CAPTURE);
701 }
702
703
473 }; // namespace content 704 }; // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698