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

Unified Diff: content/test/data/media/image_capture_test.html

Issue 2341643006: ImageCapture browser tests: use IsWebcamAvailableOnSystem() (Closed)
Patch Set: Rebase to https://crrev.com/2334223012 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
« no previous file with comments | « content/browser/webrtc/webrtc_webcam_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/media/image_capture_test.html
diff --git a/content/test/data/media/image_capture_test.html b/content/test/data/media/image_capture_test.html
index 75f8fdec06f338ab81f5009ca6902b11113a9bdb..2ed74495c716b2719231972fbb6b1a7f142c1a4f 100644
--- a/content/test/data/media/image_capture_test.html
+++ b/content/test/data/media/image_capture_test.html
@@ -7,35 +7,10 @@ B<!DOCTYPE html>
<script type="text/javascript" src="webrtc_test_utilities.js"></script>
<script>
-// Returns a Promise that is resolved if there is at least one video device or
-// rejected otherwise.
-function checkForVideoDevices() {
- return new Promise((resolve, reject) => {
- navigator.mediaDevices.enumerateDevices()
- .then(devices => {
- devices.forEach(function(device) {
- if (device.kind === "videoinput")
- return resolve();
- });
- return reject(new Error('no video devices'));
- })
- .catch(err => {
- return reject(new Error('enumerating devices: ' + err.toString()));
- });
- });
-}
-
// Runs an ImageCapture.getPhotoCapabilities().
function testCreateAndGetCapabilities() {
- checkForVideoDevices()
- .catch(err => {
- console.log('no video devices found, skipping test');
- reportTestSuccess();
- })
- .then(() => {
- const constraints = { mandatory: { maxHeight: 180, maxWidth: 320 } };
- return navigator.mediaDevices.getUserMedia({"video" : constraints});
- })
+ const constraints = { mandatory: { maxHeight: 180, maxWidth: 320 } };
+ navigator.mediaDevices.getUserMedia({"video" : constraints})
.then(stream => {
assertEquals('video', stream.getVideoTracks()[0].kind);
return new ImageCapture(stream.getVideoTracks()[0]);
@@ -63,15 +38,8 @@ function testCreateAndGetCapabilities() {
// Runs an ImageCapture.takePhoto().
function testCreateAndTakePhoto() {
- checkForVideoDevices()
- .catch(err => {
- console.log('no video devices found, skipping test');
- reportTestSuccess();
- })
- .then(() => {
- const constraints = { mandatory: { maxHeight: 180, maxWidth: 320 } };
- return navigator.mediaDevices.getUserMedia({"video" : constraints});
- })
+ const constraints = { mandatory: { maxHeight: 180, maxWidth: 320 } };
+ navigator.mediaDevices.getUserMedia({"video" : constraints})
.then(stream => {
assertEquals('video', stream.getVideoTracks()[0].kind);
return new ImageCapture(stream.getVideoTracks()[0]);
« no previous file with comments | « content/browser/webrtc/webrtc_webcam_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698