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

Unified Diff: chrome/browser/media/media_capture_devices_dispatcher.cc

Issue 14197014: Add TestBrowserThreadBundle into RenderViewHostTestHarness. Kill some unnecessary real threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged ToT Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/media_capture_devices_dispatcher.cc
diff --git a/chrome/browser/media/media_capture_devices_dispatcher.cc b/chrome/browser/media/media_capture_devices_dispatcher.cc
index 5fb643ff41dacc368cc24bdd8f25f30b6e0562ae..d9229b16704bfbf785e481fb9dc67af90a008081 100644
--- a/chrome/browser/media/media_capture_devices_dispatcher.cc
+++ b/chrome/browser/media/media_capture_devices_dispatcher.cc
@@ -86,6 +86,7 @@ MediaCaptureDevicesDispatcher* MediaCaptureDevicesDispatcher::GetInstance() {
MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher()
: devices_enumerated_(false),
+ is_device_enumeration_disabled_(false),
media_stream_capture_indicator_(new MediaStreamCaptureIndicator()),
audio_stream_indicator_(new AudioStreamIndicator()) {}
@@ -117,7 +118,7 @@ void MediaCaptureDevicesDispatcher::RemoveObserver(Observer* observer) {
const MediaStreamDevices&
MediaCaptureDevicesDispatcher::GetAudioCaptureDevices() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (!devices_enumerated_) {
+ if (!is_device_enumeration_disabled_ && !devices_enumerated_) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&content::EnsureMonitorCaptureDevices));
@@ -129,7 +130,7 @@ MediaCaptureDevicesDispatcher::GetAudioCaptureDevices() {
const MediaStreamDevices&
MediaCaptureDevicesDispatcher::GetVideoCaptureDevices() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (!devices_enumerated_) {
+ if (!is_device_enumeration_disabled_ && !devices_enumerated_) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&content::EnsureMonitorCaptureDevices));
@@ -304,6 +305,10 @@ void MediaCaptureDevicesDispatcher::GetRequestedDevice(
}
}
+void MediaCaptureDevicesDispatcher::DisableDeviceEnumerationForTesting() {
+ is_device_enumeration_disabled_ = true;
+}
+
scoped_refptr<MediaStreamCaptureIndicator>
MediaCaptureDevicesDispatcher::GetMediaStreamCaptureIndicator() {
return media_stream_capture_indicator_;

Powered by Google App Engine
This is Rietveld 408576698