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

Unified Diff: chrome/test/data/webrtc/media_devices.js

Issue 2347473004: Revert of Removed duplicated JS hasVideoInputDeviceOnSystem() test helper (Closed)
Patch Set: Created 4 years, 3 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/test/data/webrtc/media_devices.js
diff --git a/chrome/test/data/webrtc/media_devices.js b/chrome/test/data/webrtc/media_devices.js
index 38a7238ccef3e3e907b6af1936af3be4ea1bc4e6..356184e3b5e6dbf75e148f89f0a5be47aba36613 100644
--- a/chrome/test/data/webrtc/media_devices.js
+++ b/chrome/test/data/webrtc/media_devices.js
@@ -27,3 +27,27 @@
});
}
+/**
+ * Queries for video input devices on the current system using the
+ * getSources API.
+ *
+ * This does not guarantee that a getUserMedia with video will succeed, as the
+ * camera could be busy for instance.
+ *
+ * Returns has-video-input-device to the test if there is a webcam available,
+ * no-video-input-devices otherwise.
+ */
+function hasVideoInputDeviceOnSystem() {
+ MediaStreamTrack.getSources(function(devices) {
+ var hasVideoInputDevice = false;
+ devices.forEach(function(device) {
+ if (device.kind == 'video')
+ hasVideoInputDevice = true;
+ });
+
+ if (hasVideoInputDevice)
+ returnToTest('has-video-input-device');
+ else
+ returnToTest('no-video-input-devices');
+ });
+}
« no previous file with comments | « chrome/browser/media/webrtc/webrtc_webcam_browsertest.cc ('k') | content/browser/webrtc/webrtc_webcam_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698