| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test that mediastreamtrack are properly ended</title> | 4 <title>Test that mediastreamtrack are properly ended</title> |
| 5 <link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/> | 5 <link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/> |
| 6 <link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#
mediastreamtrack"> | 6 <link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#
mediastreamtrack"> |
| 7 </head> | 7 </head> |
| 8 <body> | 8 <body> |
| 9 <p class="instructions" style="display:none">When prompted, accept to share your
video and audio | 9 <p class="instructions" style="display:none">When prompted, accept to share your
video and audio |
| 10 stream, and then revoke that permission.</p> | 10 stream, and then revoke that permission.</p> |
| 11 <h1 class="instructions" style="display:none">Description</h1> | 11 <h1 class="instructions" style="display:none">Description</h1> |
| 12 <p class="instructions" style="display:none">This test checks that the video and
audio tracks of | 12 <p class="instructions" style="display:none">This test checks that the video and
audio tracks of |
| 13 MediaStream object returned by the success callback in getUserMedia are | 13 MediaStream object returned by the success callback in getUserMedia are |
| 14 correctly set into inactive state when permission is revoked.</p> | 14 correctly set into inactive state when permission is revoked.</p> |
| 15 | 15 |
| 16 <div id='log'></div> | 16 <div id='log'></div> |
| 17 <script src=../../../../../resources/testharness.js></script> | 17 <script src=../../../resources/testharness.js></script> |
| 18 <script src=../../../../../resources/testharnessreport.js></script> | 18 <script src=../../../resources/testharnessreport.js></script> |
| 19 <script src="../../../../../resources/vendor-prefix.js" data-prefixed-objects='[
{"ancestors":["navigator"], "name":"getUserMedia"}]'></script> | 19 <script src="../../../resources/vendor-prefix.js" data-prefixed-objects='[{"ance
stors":["navigator"], "name":"getUserMedia"}]'></script> |
| 20 <script> | 20 <script> |
| 21 var t = async_test("Tests that the video MediaStreamTrack objects are properly e
nded on permission revocation", {timeout: 20000}); // longer timeout since requi
res user interaction | 21 var t = async_test("Tests that the video MediaStreamTrack objects are properly e
nded on permission revocation", {timeout: 20000}); // longer timeout since requi
res user interaction |
| 22 t.step(function () { | 22 t.step(function () { |
| 23 navigator.getUserMedia({audio: true,video: true}, t.step_func(function (stream
) { | 23 navigator.getUserMedia({audio: true,video: true}, t.step_func(function (stream
) { |
| 24 var vidTrack = stream.getVideoTracks()[0]; | 24 var vidTrack = stream.getVideoTracks()[0]; |
| 25 assert_equals(vidTrack.readyState, "live", "The video track object is in liv
e state"); | 25 assert_equals(vidTrack.readyState, "live", "The video track object is in liv
e state"); |
| 26 var audTrack = stream.getAudioTracks()[0]; | 26 var audTrack = stream.getAudioTracks()[0]; |
| 27 assert_equals(audTrack.readyState, "live", "The audio track object is in liv
e state"); | 27 assert_equals(audTrack.readyState, "live", "The audio track object is in liv
e state"); |
| 28 vidTrack.onended = t.step_func(function () { | 28 vidTrack.onended = t.step_func(function () { |
| 29 assert_equals(vidTrack.readyState, "ended", "Video track has been ended
as expected"); | 29 assert_equals(vidTrack.readyState, "ended", "Video track has been ended
as expected"); |
| 30 assert_equals(audTrack.readyState, "ended", "Audio track has been ended
as expected"); | 30 assert_equals(audTrack.readyState, "ended", "Audio track has been ended
as expected"); |
| 31 assert_false(stream.active, "MediaStream has been inactive as expected")
; | 31 assert_false(stream.active, "MediaStream has been inactive as expected")
; |
| 32 t.done(); | 32 t.done(); |
| 33 }); | 33 }); |
| 34 }), function (error) {} | 34 }), function (error) {} |
| 35 ); | 35 ); |
| 36 }); | 36 }); |
| 37 </script> | 37 </script> |
| 38 </body> | 38 </body> |
| 39 </html> | 39 </html> |
| OLD | NEW |