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'); |
+ }); |
+} |