| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <!-- Image Capture Browser Test --> | |
| 5 </head> | |
| 6 <body> | |
| 7 <script type="text/javascript" src="webrtc_test_utilities.js"></script> | |
| 8 <script> | |
| 9 | |
| 10 // Runs an ImageCapture.getPhotoCapabilities(). | |
| 11 function testCreateAndGetCapabilities() { | |
| 12 var hasVideoInputDevice = false; | |
| 13 navigator.mediaDevices.enumerateDevices() | |
| 14 .then(devices => { | |
| 15 devices.forEach(function(device) { | |
| 16 if (device.kind === "videoinput") | |
| 17 hasVideoInputDevice = true; | |
| 18 }); | |
| 19 | |
| 20 if (!hasVideoInputDevice) | |
| 21 return Promise.reject("no video devices"); | |
| 22 }) | |
| 23 .catch(err => { | |
| 24 return failTest('Error enumerating devices: ' + err.toString()); | |
| 25 }); | |
| 26 | |
| 27 navigator.mediaDevices.getUserMedia({"video" : true}) | |
| 28 .then(stream => { | |
| 29 assertEquals('video', stream.getVideoTracks()[0].kind); | |
| 30 return new ImageCapture(stream.getVideoTracks()[0]); | |
| 31 }) | |
| 32 .then(capturer => { | |
| 33 return capturer.getPhotoCapabilities(); | |
| 34 }) | |
| 35 .then(capabilities => { | |
| 36 assertNotEquals(0, capabilities.imageHeight.min); | |
| 37 assertNotEquals(0, capabilities.imageHeight.current); | |
| 38 assertNotEquals(0, capabilities.imageHeight.max); | |
| 39 assertNotEquals(0, capabilities.imageWidth.min); | |
| 40 assertNotEquals(0, capabilities.imageWidth.current); | |
| 41 assertNotEquals(0, capabilities.imageWidth.max); | |
| 42 assertNotEquals(0, capabilities.zoom.min); | |
| 43 assertNotEquals(0, capabilities.zoom.current); | |
| 44 assertNotEquals(0, capabilities.zoom.max); | |
| 45 | |
| 46 reportTestSuccess(); | |
| 47 }) | |
| 48 .catch(err => { | |
| 49 return failTest(err.toString()); | |
| 50 }); | |
| 51 } | |
| 52 | |
| 53 </script> | |
| 54 </body> | |
| 55 </html> | |
| OLD | NEW |