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

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

Issue 2350693002: Remove device enumeration, caching and monitoring from MediaStreamManager. (Closed)
Patch Set: latest hta@ comments Created 4 years, 2 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 EXPECT_CALL(requester, MockDevicesChanged(_)).Times(0); 382 EXPECT_CALL(requester, MockDevicesChanged(_)).Times(0);
383 std::string label = media_stream_manager_->EnumerateDevices( 383 std::string label = media_stream_manager_->EnumerateDevices(
384 &requester, render_process_id, render_frame_id, kMockSalt, 384 &requester, render_process_id, render_frame_id, kMockSalt,
385 page_request_id, MEDIA_DEVICE_AUDIO_CAPTURE, security_origin); 385 page_request_id, MEDIA_DEVICE_AUDIO_CAPTURE, security_origin);
386 run_loop_enumeration.Run(); 386 run_loop_enumeration.Run();
387 media_stream_manager_->CancelRequest(label); 387 media_stream_manager_->CancelRequest(label);
388 388
389 // Simulate device change 389 // Simulate device change
390 EXPECT_CALL(requester, MockDevicesChanged(_)); 390 EXPECT_CALL(requester, MockDevicesChanged(_));
391 audio_manager_->SetNumAudioInputDevices(3); 391 audio_manager_->SetNumAudioInputDevices(3);
392 media_stream_manager_->OnDevicesChanged(base::SystemMonitor::DEVTYPE_AUDIO); 392 media_stream_manager_->media_devices_manager()->OnDevicesChanged(
393 base::SystemMonitor::DEVTYPE_AUDIO);
393 run_loop_device_change.Run(); 394 run_loop_device_change.Run();
394 } 395 }
395 396
396 // Check that bogus device changes where devices have not changed 397 // Check that bogus device changes where devices have not changed
397 // do not trigger a notification. 398 // do not trigger a notification.
398 { 399 {
399 base::RunLoop run_loop; 400 base::RunLoop run_loop;
400 MockMediaStreamRequester requester(media_stream_manager_.get(), &run_loop, 401 MockMediaStreamRequester requester(media_stream_manager_.get(), &run_loop,
401 4, &run_loop); 402 4, &run_loop);
402 requester.SubscribeToDeviceChangeNotifications(); 403 requester.SubscribeToDeviceChangeNotifications();
403 404
404 // Bogus OnDeviceChange, as devices have not changed. Should not trigger 405 // Bogus OnDeviceChange, as devices have not changed. Should not trigger
405 // notification. 406 // notification.
406 EXPECT_CALL(requester, MockDevicesChanged(_)).Times(0); 407 EXPECT_CALL(requester, MockDevicesChanged(_)).Times(0);
407 media_stream_manager_->OnDevicesChanged(base::SystemMonitor::DEVTYPE_AUDIO); 408 media_stream_manager_->media_devices_manager()->OnDevicesChanged(
409 base::SystemMonitor::DEVTYPE_AUDIO);
408 410
409 // Do enumeration to be able to quit the RunLoop. 411 // Do enumeration to be able to quit the RunLoop.
410 EXPECT_CALL(requester, 412 EXPECT_CALL(requester,
411 MockDevicesEnumerated(render_frame_id, page_request_id, _, _)); 413 MockDevicesEnumerated(render_frame_id, page_request_id, _, _));
412 std::string label = media_stream_manager_->EnumerateDevices( 414 std::string label = media_stream_manager_->EnumerateDevices(
413 &requester, render_process_id, render_frame_id, kMockSalt, 415 &requester, render_process_id, render_frame_id, kMockSalt,
414 page_request_id, MEDIA_DEVICE_AUDIO_CAPTURE, security_origin); 416 page_request_id, MEDIA_DEVICE_AUDIO_CAPTURE, security_origin);
415 run_loop.Run(); 417 run_loop.Run();
416 media_stream_manager_->CancelRequest(label); 418 media_stream_manager_->CancelRequest(label);
417 } 419 }
418 } 420 }
419 421
420 } // namespace content 422 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698