Chromium Code Reviews| 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, just like the actual capture, is a process | |
| 56 // kicked right after creation, we introduce a small delay to allow for | |
|
Reilly Grant (use Gerrit)
2017/04/14 19:46:17
same here
mcasas
2017/04/14 21:21:27
Done.
| |
| 57 // those to be collected. | |
| 58 // TODO(mcasas): this shouldn't be needed, https://crbug.com/711524. | |
| 59 return new Promise((resolve) => setTimeout(resolve, 100)); | |
| 60 }) | |
| 61 .then(function() { | |
| 55 return videoTrack.applyConstraints(constraints); | 62 return videoTrack.applyConstraints(constraints); |
| 56 }) | 63 }) |
| 57 .then(function() { | 64 .then(function() { |
| 58 | 65 |
| 59 settings = videoTrack.getSettings(); | 66 settings = videoTrack.getSettings(); |
| 60 assert_equals(typeof settings, 'object'); | 67 assert_equals(typeof settings, 'object'); |
| 61 | 68 |
| 62 assert_equals(constraints.advanced[0].whiteBalanceMode, | 69 assert_equals(constraints.advanced[0].whiteBalanceMode, |
| 63 settings.whiteBalanceMode, 'whiteBalanceMode'); | 70 settings.whiteBalanceMode, 'whiteBalanceMode'); |
| 64 assert_equals(constraints.advanced[0].exposureMode, settings.exposureMode, | 71 assert_equals(constraints.advanced[0].exposureMode, settings.exposureMode, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 | 105 |
| 99 t.done(); | 106 t.done(); |
| 100 }) | 107 }) |
| 101 .catch(error => { | 108 .catch(error => { |
| 102 assert_unreached("Error applying constraints: " + error.message); | 109 assert_unreached("Error applying constraints: " + error.message); |
| 103 }); | 110 }); |
| 104 | 111 |
| 105 }, 'exercises an applyConstraints() - getSettings() cycle'); | 112 }, 'exercises an applyConstraints() - getSettings() cycle'); |
| 106 | 113 |
| 107 </script> | 114 </script> |
| OLD | NEW |