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

Side by Side Diff: LayoutTests/fast/mediastream/MediaStream-oninactive.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 <p id="description"></p> 7 <p id="description"></p>
8 <div id="console"></div> 8 <div id="console"></div>
9 <script> 9 <script>
10 description("Tests MediaStream::onended callback."); 10 description("Tests MediaStream::oninactive callback.");
11 11
12 function error() { 12 function error() {
13 testFailed('Stream generation failed.'); 13 testFailed('Stream generation failed.');
14 finishJSTest(); 14 finishJSTest();
15 } 15 }
16 16
17 function getUserMedia(dictionary, callback) { 17 function getUserMedia(dictionary, callback) {
18 try { 18 try {
19 navigator.webkitGetUserMedia(dictionary, callback, error); 19 navigator.webkitGetUserMedia(dictionary, callback, error);
20 } catch (e) { 20 } catch (e) {
21 testFailed('webkitGetUserMedia threw exception :' + e); 21 testFailed('webkitGetUserMedia threw exception :' + e);
22 finishJSTest(); 22 finishJSTest();
23 } 23 }
24 } 24 }
25 25
26 var stream; 26 var stream;
27 27
28 function streamEnded2() { 28 function streamInactive2() {
29 testPassed('streamEnded was called.'); 29 testPassed('streamInactive was called.');
30 shouldBeTrue('stream.ended'); 30 shouldBeFalse('stream.active');
31 finishJSTest(); 31 finishJSTest();
32 } 32 }
33 33
34 function gotStream2(s) { 34 function gotStream2(s) {
35 stream = new webkitMediaStream(s); 35 stream = new webkitMediaStream(s);
36 shouldBeFalse('stream.ended'); 36 shouldBeTrue('stream.active');
37 try { 37 try {
38 stream.onended = streamEnded2; 38 stream.oninactive = streamInactive2;
39 s.stop(); 39 s.stop();
40 } catch (e) { 40 } catch (e) {
41 testFailed('MediaStream threw exception :' + e); 41 testFailed('MediaStream threw exception :' + e);
42 finishJSTest(); 42 finishJSTest();
43 } 43 }
44 } 44 }
45 45
46 function streamEnded() { 46 function streamInactive() {
47 testPassed('streamEnded was called.'); 47 testPassed('streamInactive was called.');
48 shouldBeTrue('stream.ended'); 48 shouldBeFalse('stream.active');
49 49
50 getUserMedia({audio:true, video:true}, gotStream2); 50 getUserMedia({audio:true, video:true}, gotStream2);
51 } 51 }
52 52
53 function gotStream(s) { 53 function gotStream(s) {
54 stream = s; 54 stream = s;
55 shouldBeFalse('stream.ended'); 55 shouldBeTrue('stream.active');
56 try { 56 try {
57 stream.onended = streamEnded; 57 stream.oninactive = streamInactive;
58 stream.stop(); 58 stream.stop();
59 } catch (e) { 59 } catch (e) {
60 testFailed('MediaStream threw exception :' + e); 60 testFailed('MediaStream threw exception :' + e);
61 finishJSTest(); 61 finishJSTest();
62 } 62 }
63 } 63 }
64 64
65 getUserMedia({audio:true, video:true}, gotStream); 65 getUserMedia({audio:true, video:true}, gotStream);
66 66
67 window.jsTestIsAsync = true; 67 window.jsTestIsAsync = true;
68 window.successfullyParsed = true; 68 window.successfullyParsed = true;
69 </script> 69 </script>
70 </body> 70 </body>
71 </html> 71 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698