| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 // |stream| must be created _after_ |mock| is constructed to give the | 27 // |stream| must be created _after_ |mock| is constructed to give the |
| 28 // latter time to override the bindings. | 28 // latter time to override the bindings. |
| 29 var stream = canvas.captureStream(); | 29 var stream = canvas.captureStream(); |
| 30 assert_equals(stream.getAudioTracks().length, 0); | 30 assert_equals(stream.getAudioTracks().length, 0); |
| 31 assert_equals(stream.getVideoTracks().length, 1); | 31 assert_equals(stream.getVideoTracks().length, 1); |
| 32 | 32 |
| 33 var videoTrack = stream.getVideoTracks()[0]; | 33 var videoTrack = stream.getVideoTracks()[0]; |
| 34 assert_equals(typeof videoTrack.getCapabilities, 'function'); | 34 assert_equals(typeof videoTrack.getCapabilities, 'function'); |
| 35 | 35 |
| 36 // |videoTrack|s capabilities, just like the actual capture, is a process | 36 // |videoTrack|'s capabilities gathering, just like the actual capture, is |
| 37 // kicked right after creation, we introduce a small delay to allow for | 37 // a process kicked off right after creation, we introduce a small delay |
| 38 // those to be collected. | 38 // to allow for those to be collected. |
| 39 // TODO(mcasas): this shouldn't be needed, https://crbug.com/711524. |
| 39 setTimeout(() => { | 40 setTimeout(() => { |
| 40 capabilities = videoTrack.getCapabilities(); | 41 capabilities = videoTrack.getCapabilities(); |
| 41 assert_equals(typeof capabilities, 'object'); | 42 assert_equals(typeof capabilities, 'object'); |
| 42 | 43 |
| 43 assert_equals(capabilities.whiteBalanceMode.length, | 44 assert_equals(capabilities.whiteBalanceMode.length, |
| 44 mock_capabilities.supported_white_balance_modes.length, | 45 mock_capabilities.supported_white_balance_modes.length, |
| 45 'whiteBalanceMode'); | 46 'whiteBalanceMode'); |
| 46 for (i = 0; i < capabilities.whiteBalanceMode.length; ++i) { | 47 for (i = 0; i < capabilities.whiteBalanceMode.length; ++i) { |
| 47 assert_equals( | 48 assert_equals( |
| 48 capabilities.whiteBalanceMode[i], | 49 capabilities.whiteBalanceMode[i], |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 t.done(); | 138 t.done(); |
| 138 }, 100); | 139 }, 100); |
| 139 }, | 140 }, |
| 140 error => { | 141 error => { |
| 141 assert_unreached("Error creating MockImageCapture: " + error); | 142 assert_unreached("Error creating MockImageCapture: " + error); |
| 142 }) | 143 }) |
| 143 | 144 |
| 144 }, 'exercises MediaStreamTrack.getCapabilities()'); | 145 }, 'exercises MediaStreamTrack.getCapabilities()'); |
| 145 | 146 |
| 146 </script> | 147 </script> |
| OLD | NEW |