| 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..6b8b6461ccef696d6ab651dbdd94aab8736cca93 100644
|
| --- a/content/test/data/media/image_capture_test.html
|
| +++ b/content/test/data/media/image_capture_test.html
|
| @@ -1,4 +1,4 @@
|
| -B<!DOCTYPE html>
|
| +<!DOCTYPE html>
|
| <html>
|
| <head>
|
| <!-- Image Capture Browser Test -->
|
| @@ -7,35 +7,24 @@
|
| <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()
|
| + var hasVideoInputDevice = false;
|
| + navigator.mediaDevices.enumerateDevices()
|
| + .then(devices => {
|
| + devices.forEach(function(device) {
|
| + if (device.kind === "videoinput")
|
| + hasVideoInputDevice = true;
|
| + });
|
| +
|
| + if (!hasVideoInputDevice)
|
| + return Promise.reject("no video devices");
|
| + })
|
| .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});
|
| - })
|
| + return failTest('Error enumerating devices: ' + err.toString());
|
| + });
|
| +
|
| + navigator.mediaDevices.getUserMedia({"video" : true})
|
| .then(stream => {
|
| assertEquals('video', stream.getVideoTracks()[0].kind);
|
| return new ImageCapture(stream.getVideoTracks()[0]);
|
| @@ -61,35 +50,6 @@
|
| });
|
| }
|
|
|
| -// 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});
|
| - })
|
| - .then(stream => {
|
| - assertEquals('video', stream.getVideoTracks()[0].kind);
|
| - return new ImageCapture(stream.getVideoTracks()[0]);
|
| - })
|
| - .then(capturer => {
|
| - return capturer.takePhoto();
|
| - })
|
| - .then(blob => {
|
| - assertTrue(blob.type != undefined);
|
| - assertNotEquals(0, blob.size);
|
| -
|
| - reportTestSuccess();
|
| - })
|
| - .catch(err => {
|
| - return failTest(err.toString());
|
| - });
|
| -}
|
| -
|
| </script>
|
| </body>
|
| </html>
|
|
|