| 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> | 4 <script> |
| 5 | 5 |
| 6 // Run captureStream() on <video>/<audio>s and inspect the generated Stream. | 6 // Run captureStream() on <video>/<audio>s and inspect the generated Stream. |
| 7 | 7 |
| 8 test(function() { | 8 var makeAsyncTest = function(filename, numTracks) { |
| 9 var video = document.createElement('video'); | |
| 10 assert_throws("NotSupportedError", function () { video.captureStream() }, | |
| 11 "captureStream() cannot be created out of a source-less <video>"
); | |
| 12 }, 'check that captureStream() raises an exception on a <video> with no source.'
); | |
| 13 | |
| 14 test(function() { | |
| 15 var audio = document.createElement('audio'); | |
| 16 assert_throws("NotSupportedError", function () { audio.captureStream() }, | |
| 17 "captureStream() cannot be created out of a source-less <audio>"
); | |
| 18 }, 'check that captureStream() raises an exception on an <audio> with no source.
'); | |
| 19 | |
| 20 var makeAsyncTest = function(filename) { | |
| 21 async_test(function() { | 9 async_test(function() { |
| 22 var video = document.createElement('video'); | 10 var video = document.createElement('video'); |
| 23 video.src = "../../http/tests/media/resources/media-source/webm/" + filename
; | 11 video.src = "../../http/tests/media/resources/media-source/webm/" + filename
; |
| 24 video.onerror = this.unreached_func("<video> error"); | 12 video.onerror = this.unreached_func("<video> error"); |
| 13 video.play(); |
| 25 | 14 |
| 26 video.onloadstart = this.step_func_done(function() { | 15 var stream = video.captureStream(); |
| 27 var stream = video.captureStream(); | 16 assert_not_equals(stream, null, "error generating stream"); |
| 28 assert_not_equals(stream, null, "error generating stream"); | 17 |
| 18 // onactive event is marked for deprecation (https://crbug.com/649328) |
| 19 stream.onactive = this.step_func_done(function() { |
| 20 // The stream got a (number of) MediaStreamTracks added. |
| 21 assert_equals(stream.getVideoTracks().length, numTracks['vid'], 'video'); |
| 22 assert_equals(stream.getAudioTracks().length, numTracks['aud'], 'audio'); |
| 29 }); | 23 }); |
| 30 }), "<video>.captureStream()"; | 24 }), "<video>.captureStream()"; |
| 31 }; | 25 }; |
| 32 | 26 |
| 33 generate_tests(makeAsyncTest, | 27 generate_tests(makeAsyncTest, [ |
| 34 [[ "video-only", "test-v-128k-320x240-24fps-8kfr.webm"], | 28 [ "video-only", "test-v-128k-320x240-24fps-8kfr.webm", {vid : 1, aud : 0} ], |
| 35 [ "audio-only", "test-a-128k-44100Hz-1ch.webm"], | 29 [ "audio-only", "test-a-128k-44100Hz-1ch.webm", {vid : 0, aud : 1} ], |
| 36 [ "video+audio", "test.webm"]]); | 30 [ "video+audio", "test.webm", {vid : 1, aud : 1} ] |
| 31 ]); |
| 37 | 32 |
| 38 </script> | 33 </script> |
| OLD | NEW |