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

Unified Diff: content/public/test/browser_test_utils.h

Issue 2310683003: Removed duplicated JS hasVideoInputDeviceOnSystem() test helper (Closed)
Patch Set: Initial commit 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: 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

Powered by Google App Engine
This is Rietveld 408576698