Index: content/public/test/browser_test_utils.h |
diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h |
index 964cf670722fe525c0cf0d91b80292d103c2d9f5..19c18e5e35cfc3e1e5a5d35755bd56c7d213c47b 100644 |
--- a/content/public/test/browser_test_utils.h |
+++ b/content/public/test/browser_test_utils.h |
@@ -166,6 +166,29 @@ void SimulateKeyPress(WebContents* web_contents, |
bool alt, |
bool command); |
+// |
+// 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. |
+static const std::string hasVideoInputDeviceOnSystem = |
mcasas
2016/09/06 15:34:54
Move this string to the anonymous namespace in the
lunalu1
2016/09/06 20:56:13
Done.
|
+ "(function() {" |
+ "MediaStreamTrack.getSources(function(devices) {" |
+ "devices.forEach(function(device) {" |
+ "if (device.kind == 'video')" |
+ "returnToTest('has-video-input-device');" |
+ "});" |
+ "returnToTest('no-video-input-devices');" |
+ "});" |
+ "})()"; |
mcasas
2016/09/06 15:34:54
Can we indent these lines to make them more readab
lunalu1
2016/09/06 20:56:13
Done.
|
+ |
+// Method to check what devices we have on the system. |
+bool HasWebcamAvailableOnSystem(WebContents* tab_contents); |
+ |
// Allow ExecuteScript* methods to target either a WebContents or a |
// RenderFrameHost. Targetting a WebContents means executing the script in the |
// RenderFrameHost returned by WebContents::GetMainFrame(), which is the main |