OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Adding a track to a finished MediaStream</title> |
| 5 <link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/> |
| 6 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#wi
dl-MediaStreamTrackList-add-void-MediaStreamTrack-track"> |
| 7 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#wi
dl-MediaStreamTrack-stop-void"> |
| 8 <link rel='stylesheet' href='../../../../../resources/testharness.css' media='al
l'/> |
| 9 </head> |
| 10 <body> |
| 11 <p class="instructions" style="display:none">When prompted, accept to share your
audio stream, then |
| 12 your video stream.</p> |
| 13 <h1 class="instructions" style="display:none">Description</h1> |
| 14 <p class="instructions" style="display:none">This test checks that adding a trac
k to a finished |
| 15 MediaStream raises an INVALID_STATE_ERR exception.</p> |
| 16 |
| 17 <div id='log'></div> |
| 18 <script src=../../../../../resources/testharness.js></script> |
| 19 <script src=../../../../../resources/testharnessreport.js></script> |
| 20 <script src="../../../../../resources/vendor-prefix.js" data-prefixed-objects='[
{"ancestors":["navigator"], "name":"getUserMedia"}]'></script> |
| 21 <script> |
| 22 var t = async_test("Tests that an addition to a finished MediaStream raises an e
xception", {timeout:20000}); |
| 23 t.step(function () { |
| 24 var audio, video; |
| 25 |
| 26 navigator.getUserMedia({audio:true}, gotAudio, function() {}); |
| 27 function gotAudio(stream) { |
| 28 audio = stream; |
| 29 navigator.getUserMedia({video:true}, gotVideo, function() {}); |
| 30 } |
| 31 |
| 32 function gotVideo(stream) { |
| 33 video = stream; |
| 34 t.step(function () { |
| 35 audio.getAudioTracks()[0].stop(); |
| 36 assert_true(audio.ended, "Audio stream is ended after stopping its only a
udio track"); |
| 37 assert_throws("INVALID_STATE_ERR", function () { |
| 38 video.addTrack(audio.getAudioTracks()[0]); |
| 39 }, "Adding a track from a finished stream raises an INVALID_STATE_ERR
exception"); |
| 40 assert_throws("INVALID_STATE_ERR", function () { |
| 41 audio.removeTrack(audio.getAudioTracks()[0]); |
| 42 }, "Removing a track from a finished stream raises an INVALID_STATE_ER
R exception"); |
| 43 }); |
| 44 t.done(); |
| 45 } |
| 46 }); |
| 47 </script> |
| 48 </body> |
| 49 </html> |
OLD | NEW |