| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 }, | 45 }, |
| 46 error => { | 46 error => { |
| 47 assert_unreached("Error creating MockImageCapture: " + error); | 47 assert_unreached("Error creating MockImageCapture: " + error); |
| 48 }) | 48 }) |
| 49 .then(() => { | 49 .then(() => { |
| 50 // |stream| must be created _after_ |mock| is constructed to give the | 50 // |stream| must be created _after_ |mock| is constructed to give the |
| 51 // latter time to override the bindings. | 51 // latter time to override the bindings. |
| 52 var stream = canvas.captureStream(); | 52 var stream = canvas.captureStream(); |
| 53 videoTrack = stream.getVideoTracks()[0]; | 53 videoTrack = stream.getVideoTracks()[0]; |
| 54 | 54 |
| 55 // |videoTrack|'s capabilities gathering, just like the actual capture, is |
| 56 // a process kicked off right after creation, we introduce a small delay |
| 57 // to allow for those to be collected, since they are needed to understand |
| 58 // which constraints are supported in applyConstraints(). |
| 59 // TODO(mcasas): this shouldn't be needed, https://crbug.com/711524. |
| 60 return new Promise(resolve => setTimeout(resolve, 100)); |
| 61 }) |
| 62 .then(function() { |
| 55 return videoTrack.applyConstraints(constraints); | 63 return videoTrack.applyConstraints(constraints); |
| 56 }) | 64 }) |
| 57 .then(function() { | 65 .then(function() { |
| 58 | 66 |
| 59 settings = videoTrack.getSettings(); | 67 settings = videoTrack.getSettings(); |
| 60 assert_equals(typeof settings, 'object'); | 68 assert_equals(typeof settings, 'object'); |
| 61 | 69 |
| 62 assert_equals(constraints.advanced[0].whiteBalanceMode, | 70 assert_equals(constraints.advanced[0].whiteBalanceMode, |
| 63 settings.whiteBalanceMode, 'whiteBalanceMode'); | 71 settings.whiteBalanceMode, 'whiteBalanceMode'); |
| 64 assert_equals(constraints.advanced[0].exposureMode, settings.exposureMode, | 72 assert_equals(constraints.advanced[0].exposureMode, settings.exposureMode, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 106 |
| 99 t.done(); | 107 t.done(); |
| 100 }) | 108 }) |
| 101 .catch(error => { | 109 .catch(error => { |
| 102 assert_unreached("Error applying constraints: " + error.message); | 110 assert_unreached("Error applying constraints: " + error.message); |
| 103 }); | 111 }); |
| 104 | 112 |
| 105 }, 'exercises an applyConstraints() - getSettings() cycle'); | 113 }, 'exercises an applyConstraints() - getSettings() cycle'); |
| 106 | 114 |
| 107 </script> | 115 </script> |
| OLD | NEW |