| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
| 4 <script src="../resources/mojo-helpers.js"></script> | 4 <script src="../resources/mojo-helpers.js"></script> |
| 5 <script src="resources/mock-imagecapture.js"></script> | 5 <script src="resources/mock-imagecapture.js"></script> |
| 6 <body> | 6 <body> |
| 7 <canvas id='canvas' width=10 height=10/> | 7 <canvas id='canvas' width=10 height=10/> |
| 8 </body> | 8 </body> |
| 9 <script> | 9 <script> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 colorTemperature : 6000, | 36 colorTemperature : 6000, |
| 37 brightness : 3, | 37 brightness : 3, |
| 38 contrast : 4, | 38 contrast : 4, |
| 39 saturation : 5, | 39 saturation : 5, |
| 40 sharpness : 6 | 40 sharpness : 6 |
| 41 }; | 41 }; |
| 42 mockImageCaptureReady | 42 mockImageCaptureReady |
| 43 .then(mock => { | 43 .then(mock => { |
| 44 theMock = mock; | 44 theMock = mock; |
| 45 return new ImageCapture(stream.getVideoTracks()[0]); | 45 return new ImageCapture(stream.getVideoTracks()[0]); |
| 46 }) | 46 }, |
| 47 .catch(error => { | 47 error => { |
| 48 assert_unreached("Error creating MockImageCapture: " + error); | 48 assert_unreached("Error creating MockImageCapture: " + error); |
| 49 }) | 49 }) |
| 50 .then(capturer => { | 50 .then(capturer => { |
| 51 return capturer.setOptions(optionsDict); | 51 return capturer.setOptions(optionsDict); |
| 52 }) | 52 }) |
| 53 .then(function() { | 53 .then(function() { |
| 54 assert_true(theMock.options().has_zoom, 'has_zoom must be true'); | 54 assert_true(theMock.options().has_zoom, 'has_zoom must be true'); |
| 55 assert_approx_equals(optionsDict.zoom, theMock.options().zoom, 0.1, 'zoom
value'); | 55 assert_approx_equals(optionsDict.zoom, theMock.options().zoom, 0.1, 'zoom
value'); |
| 56 assert_equals(true, theMock.options().has_width, 'has_width must be true')
; | 56 assert_equals(true, theMock.options().has_width, 'has_width must be true')
; |
| 57 assert_equals(optionsDict.imageWidth, theMock.options().width, 'width valu
e'); | 57 assert_equals(optionsDict.imageWidth, theMock.options().width, 'width valu
e'); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 'fillLightMode value'); | 102 'fillLightMode value'); |
| 103 assert_true(theMock.options().has_color_temperature, | 103 assert_true(theMock.options().has_color_temperature, |
| 104 'has_color_temperature must be true'); | 104 'has_color_temperature must be true'); |
| 105 assert_equals(optionsDict.colorTemperature, | 105 assert_equals(optionsDict.colorTemperature, |
| 106 theMock.options().color_temperature, | 106 theMock.options().color_temperature, |
| 107 'colorTemperature value'); | 107 'colorTemperature value'); |
| 108 | 108 |
| 109 t.done(); | 109 t.done(); |
| 110 }) | 110 }) |
| 111 .catch(error => { | 111 .catch(error => { |
| 112 assert_unreached("Error during setOptions(): " + error); | 112 assert_unreached("Error during setOptions(): " + error.message); |
| 113 }); | 113 }); |
| 114 }, 'exercises the ImageCapture API setOptions()'); | 114 }, 'exercises ImageCapture.setOptions(options)'); |
| 115 | 115 |
| 116 </script> | 116 </script> |
| OLD | NEW |