Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: LayoutTests/fast/mediastream/MediaStream-stop.html

Issue 827673002: Add MediaStream.active attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Allow addTrack/removeTrack when mediastream.ended is true Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script> 7 <script>
8 description("Test cloning mediastreams onended."); 8 description("Test cloning mediastreams oninactive.");
9 9
10 var cloned_stream; 10 var cloned_stream;
11 11
12 function onStreamEnded() { 12 function error() {
13 testPassed('Stream ended.'); 13 testFailed('Stream generation failed.');
14 finishJSTest(); 14 finishJSTest();
15 } 15 }
16 16
17 function onTrackAdded() { 17 function getUserMedia(dictionary, callback) {
18 testPassed('Mock test track added.'); 18 try {
19 shouldBe('cloned_stream.getVideoTracks().length', '1'); 19 navigator.webkitGetUserMedia(dictionary, callback, error);
20 cloned_stream.getVideoTracks()[0].stop(); 20 } catch (e) {
21 testFailed('webkitGetUserMedia threw exception :' + e);
22 finishJSTest();
23 }
21 } 24 }
22 25
23 function run(s) { 26 function onStreamInactive() {
24 cloned_stream = new webkitMediaStream(); 27 testPassed('Stream inactive.');
25 cloned_stream.onaddtrack = onTrackAdded; 28 finishJSTest();
26 cloned_stream.onended = onStreamEnded;
27 } 29 }
28 30
29 run(); 31 function gotStream(s) {
32 stream = s;
33
34 cloned_stream = stream.clone();
35 cloned_stream.oninactive = onStreamInactive;
36 shouldBe('cloned_stream.getVideoTracks().length', '1');
37 shouldBe('cloned_stream.getAudioTracks().length', '1');
38 cloned_stream.getVideoTracks()[0].stop();
39 cloned_stream.getAudioTracks()[0].stop();
40 }
41
42 getUserMedia({audio:true, video:true}, gotStream);
30 43
31 window.jsTestIsAsync = true; 44 window.jsTestIsAsync = true;
32 window.successfullyParsed = true; 45 window.successfullyParsed = true;
33 </script> 46 </script>
34 </body> 47 </body>
35 </html> 48 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698