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

Side by Side Diff: content/test/data/media/getusermedia.html

Issue 218763007: Update MediaStreamTrack::Stop to latest draft. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/media/webrtc_local_audio_track_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script>
4 <script type="text/javascript"> 4 <script type="text/javascript">
5 $ = function(id) { 5 $ = function(id) {
6 return document.getElementById(id); 6 return document.getElementById(id);
7 }; 7 };
8 8
9 var gLocalStream = null; 9 var gLocalStream = null;
10 10
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 // This test that a MediaStream can be cloned and that the clone can 151 // This test that a MediaStream can be cloned and that the clone can
152 // be rendered. 152 // be rendered.
153 function getUserMediaAndClone() { 153 function getUserMediaAndClone() {
154 console.log('Calling getUserMediaAndClone.'); 154 console.log('Calling getUserMediaAndClone.');
155 navigator.webkitGetUserMedia({video: true, audio: true}, 155 navigator.webkitGetUserMedia({video: true, audio: true},
156 createAndRenderClone, failedCallback); 156 createAndRenderClone, failedCallback);
157 } 157 }
158 158
159 // Creates two MediaStream and renders them locally. When the video of both 159 // Creates two MediaStream and renders them locally. When the video of both
160 // streams are detected to be rolling, we stop the local stream. Since both 160 // streams are detected to be rolling, we stop the local video tracks one at
161 // streams have the same source, both video streams should stop. If they do, 161 // the time.
162 // the test succeeds.
163 function twoGetUserMediaAndStop(constraints) { 162 function twoGetUserMediaAndStop(constraints) {
164 console.log('Calling Two GetUserMedia'); 163 console.log('Calling Two GetUserMedia');
165 navigator.webkitGetUserMedia( 164 navigator.webkitGetUserMedia(
166 constraints, 165 constraints,
167 function(stream) { 166 function(stream) {
168 displayAndDetectVideo(stream, requestSecondGetUserMedia); 167 displayAndDetectVideo(stream, requestSecondGetUserMedia);
169 }, 168 },
170 failedCallback); 169 failedCallback);
171 var requestSecondGetUserMedia = function() { 170 var requestSecondGetUserMedia = function() {
172 navigator.webkitGetUserMedia( 171 navigator.webkitGetUserMedia(
173 constraints, 172 constraints,
174 function(stream) { 173 function(stream) {
175 displayIntoVideoElement(stream, 174 displayIntoVideoElement(stream,
176 stopStreamAndVerifyAllLocalViewsDontPlayVideo, 'local-view-2'); 175 function() {
176 stopBothVideoTracksAndVerify(stream);
177 },
178 'local-view-2');
177 }, 179 },
178 failedCallback); 180 failedCallback);
179 }; 181 };
180 182
181 var stopStreamAndVerifyAllLocalViewsDontPlayVideo = function() { 183 var stopBothVideoTracksAndVerify = function(streamPlayingInLocalView2) {
182 gLocalStream.getVideoTracks()[0].stop(); 184 streamPlayingInLocalView2.getVideoTracks()[0].stop();
183
184 // Since local-view and local-view-2 are playing the video from the same
185 // source, both of them should stop.
186 waitForVideoToStop('local-view');
187 waitForVideoToStop('local-view-2'); 185 waitForVideoToStop('local-view-2');
186 // Make sure the video track in gLocalStream is still playing in
187 // 'local-view1' and then stop it.
188 displayAndDetectVideo(gLocalStream, stopVideoTrack);
188 }; 189 };
189 } 190 }
190 191
191 function failedCallback(error) { 192 function failedCallback(error) {
192 failTest('GetUserMedia call failed with code ' + error.code); 193 failTest('GetUserMedia call failed with code ' + error.code);
193 } 194 }
194 195
195 function plugStreamIntoVideoElement(stream, videoElement) { 196 function plugStreamIntoVideoElement(stream, videoElement) {
196 gLocalStream = stream; 197 gLocalStream = stream;
197 var localStreamUrl = URL.createObjectURL(stream); 198 var localStreamUrl = URL.createObjectURL(stream);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 <tr> 387 <tr>
387 <td><video width="320" height="240" id="local-view-2" 388 <td><video width="320" height="240" id="local-view-2"
388 autoplay="autoplay"></video></td> 389 autoplay="autoplay"></video></td>
389 <!-- Canvases are named after their corresponding video elements. --> 390 <!-- Canvases are named after their corresponding video elements. -->
390 <td><canvas width="320" height="240" id="local-view-2-canvas" 391 <td><canvas width="320" height="240" id="local-view-2-canvas"
391 style="display:none"></canvas></td> 392 style="display:none"></canvas></td>
392 </tr> 393 </tr>
393 </table> 394 </table>
394 </body> 395 </body>
395 </html> 396 </html>
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_local_audio_track_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698