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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/mediastream/MediaStream-add-remove-tracks.html

Issue 1570263002: MediaRecorder: make EventListener and stop if receiving on{add,remove}track from WebMediaStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 adding and removing tracks."); 8 description("Test adding and removing tracks.");
9 9
10 var stream1; 10 var stream1;
(...skipping 27 matching lines...) Expand all
38 38
39 function tryRemoveTrack(stream, track) { 39 function tryRemoveTrack(stream, track) {
40 try { 40 try {
41 stream.removeTrack(track); 41 stream.removeTrack(track);
42 } catch (exception) { 42 } catch (exception) {
43 testFailed("removeTrack threw an exception."); 43 testFailed("removeTrack threw an exception.");
44 finishJSTest(); 44 finishJSTest();
45 } 45 }
46 } 46 }
47 47
48 function shouldNotFire() {
49 testFailed("\"addtrack\" or \"removetrack\" events should not fire as a resu lt of local addTrack() or removeTrack() operations.");
50 }
51
52 function onStreamInactive() { 48 function onStreamInactive() {
53 testPassed('Stream1 inactive.'); 49 testPassed('Stream1 inactive.');
54 shouldBeFalse('stream1.active'); 50 shouldBeFalse('stream1.active');
55 setTimeout(finishJSTest, 0); 51 setTimeout(finishJSTest, 0);
56 } 52 }
57 53
58 function onStreamActive() { 54 function onStreamActive() {
59 testPassed('Stream1 active.'); 55 testPassed('Stream1 active.');
60 shouldBeTrue('stream1.active'); 56 shouldBeTrue('stream1.active');
61 stream1.oninactive = onStreamInactive; 57 stream1.oninactive = onStreamInactive;
(...skipping 10 matching lines...) Expand all
72 stream2 = s; 68 stream2 = s;
73 69
74 shouldBe('stream1.getAudioTracks().length', '1'); 70 shouldBe('stream1.getAudioTracks().length', '1');
75 shouldBe('stream1.getVideoTracks().length', '1'); 71 shouldBe('stream1.getVideoTracks().length', '1');
76 shouldBe('stream1.getTracks().length', '2'); 72 shouldBe('stream1.getTracks().length', '2');
77 73
78 shouldBe('stream2.getAudioTracks().length', '1'); 74 shouldBe('stream2.getAudioTracks().length', '1');
79 shouldBe('stream2.getVideoTracks().length', '1'); 75 shouldBe('stream2.getVideoTracks().length', '1');
80 shouldBe('stream2.getTracks().length', '2'); 76 shouldBe('stream2.getTracks().length', '2');
81 77
82 stream1.onaddtrack = shouldNotFire; 78 stream1.onaddtrack = function() {};
perkj_chrome 2016/01/11 08:21:20 This does not seem right according to spec. (it wa
83 stream1.onremovetrack = shouldNotFire; 79 stream1.onremovetrack = function() {};
84 80
85 // remove a track of each kind 81 // remove a track of each kind
86 audioTrack = stream1.getAudioTracks()[0]; 82 audioTrack = stream1.getAudioTracks()[0];
87 videoTrack = stream1.getVideoTracks()[0]; 83 videoTrack = stream1.getVideoTracks()[0];
88 84
89 tryRemoveTrack(stream1, audioTrack); 85 tryRemoveTrack(stream1, audioTrack);
90 // verify removed tracks 86 // verify removed tracks
91 shouldBe('stream1.getAudioTracks().length', '0'); 87 shouldBe('stream1.getAudioTracks().length', '0');
92 // verify that gettracks length is reduced by 1 88 // verify that gettracks length is reduced by 1
93 shouldBe('stream1.getTracks().length', '1'); 89 shouldBe('stream1.getTracks().length', '1');
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 getUserMedia({audio:true, video:true}, gotStream2); 151 getUserMedia({audio:true, video:true}, gotStream2);
156 } 152 }
157 153
158 getUserMedia({audio:true, video:true}, gotStream1); 154 getUserMedia({audio:true, video:true}, gotStream1);
159 155
160 window.jsTestIsAsync = true; 156 window.jsTestIsAsync = true;
161 window.successfullyParsed = true; 157 window.successfullyParsed = true;
162 </script> 158 </script>
163 </body> 159 </body>
164 </html> 160 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698