| 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 // Run createStream() on <video>s and <audio>s. | 5 // Run createStream() on <video>s and <audio>s. |
| 6 | 6 |
| 7 test(function() { | 7 test(function() { |
| 8 var video = document.createElement('video'); | 8 var video = document.createElement('video'); |
| 9 assert_throws("NotSupportedError", function () { video.captureStream() }, | 9 assert_throws("NotSupportedError", function () { video.captureStream() }, |
| 10 "captureStream() cannot be created out of a source-less <video>"
); | 10 "captureStream() cannot be created out of a source-less <video>"
); |
| 11 }, 'check that captureStream() raises an exception on a <video> with no source.'
); | 11 }, 'check that captureStream() raises an exception on a <video> with no source.'
); |
| 12 | 12 |
| 13 test(function() { | 13 test(function() { |
| 14 var audio = document.createElement('audio'); | 14 var audio = document.createElement('audio'); |
| 15 assert_throws("NotSupportedError", function () { audio.captureStream() }, | 15 assert_throws("NotSupportedError", function () { audio.captureStream() }, |
| 16 "captureStream() cannot be created out of a source-less <audio>"
); | 16 "captureStream() cannot be created out of a source-less <audio>"
); |
| 17 }, 'check that captureStream() raises an exception on an <audio> with no source.
'); | 17 }, 'check that captureStream() raises an exception on an <audio> with no source.
'); |
| 18 | 18 |
| 19 test(function() { | 19 test(function() { |
| 20 var video = document.createElement('video'); | 20 var video = document.createElement('video'); |
| 21 video.src = "file:///super_duper_videos/amazing_video.webm"; | 21 video.src = "file:///super_duper_videos/amazing_video.webm"; |
| 22 video.load(); | 22 video.onloadstart = function() { |
| 23 var stream = video.captureStream(); | 23 var stream = video.captureStream(); |
| 24 | 24 |
| 25 assert_not_equals(stream, null); | 25 assert_not_equals(stream, null); |
| 26 assert_equals(1, stream.getVideoTracks().length); | 26 assert_equals(1, stream.getVideoTracks().length); |
| 27 assert_equals(0, stream.getAudioTracks().length); | 27 assert_equals(0, stream.getAudioTracks().length); |
| 28 } |
| 28 }, 'check <video> captureStream().'); | 29 }, 'check <video> captureStream().'); |
| 29 | 30 |
| 30 test(function() { | 31 test(function() { |
| 31 var audio = document.createElement('audio'); | 32 var audio = document.createElement('audio'); |
| 32 audio.src = "file:///super_duper_videos/amazing_audio_file.webm"; | 33 audio.src = "file:///super_duper_videos/amazing_audio_file.webm"; |
| 33 audio.load(); | 34 audio.onloadstart = function() { |
| 34 var stream = audio.captureStream(); | 35 var stream = audio.captureStream(); |
| 35 | 36 |
| 36 // TODO(mcasas): http://crbug.com/575492, implement <audio>.captureStream(). | 37 // TODO(mcasas): http://crbug.com/575492, implement <audio>.captureStream(). |
| 37 assert_equals(stream, null); | 38 assert_equals(stream, null); |
| 39 }; |
| 38 }, 'check <audio> captureStream().'); | 40 }, 'check <audio> captureStream().'); |
| 39 | 41 |
| 40 test(function() { | 42 test(function() { |
| 41 var video = document.createElement('video'); | 43 var video = document.createElement('video'); |
| 42 | 44 |
| 43 const onEncrypted = this.step_func_done(); | 45 const onEncrypted = this.step_func_done(); |
| 44 | 46 |
| 45 assert_equals(null, video.error); | 47 assert_equals(null, video.error); |
| 46 assert_equals(null, video.mediaKeys); | 48 assert_equals(null, video.mediaKeys); |
| 47 video.onencrypted = onEncrypted; | 49 video.onencrypted = onEncrypted; |
| 48 | 50 |
| 49 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(a
ccess) { | 51 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(a
ccess) { |
| 50 return access.createMediaKeys(); | 52 return access.createMediaKeys(); |
| 51 }).then(function(mediaKeys) { | 53 }).then(function(mediaKeys) { |
| 52 return video.setMediaKeys(mediaKeys); | 54 return video.setMediaKeys(mediaKeys); |
| 53 }).then(function(result) { | 55 }).then(function(result) { |
| 54 video.src = "../../media/content/test-encrypted.webm"; | 56 video.src = "../../media/content/test-encrypted.webm"; |
| 55 video.load(); | |
| 56 assert_throws("NotSupportedError", | 57 assert_throws("NotSupportedError", |
| 57 function() { var stream = video.captureStream(); }, | 58 function() { var stream = video.captureStream(); }, |
| 58 "Cannot create a captureStream() out of a protected <video>"
); | 59 "Cannot create a captureStream() out of a protected <video>"
); |
| 59 }); | 60 }); |
| 60 | 61 |
| 61 }, 'check <video> captureStream() fails on an encrypted/protected media'); | 62 }, 'check <video> captureStream() fails on an encrypted/protected media'); |
| 62 | 63 |
| 63 </script> | 64 </script> |
| OLD | NEW |