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

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: Rebased and 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.
phoglund_chromium 2014/04/09 15:51:31 ... One at a time.
perkj_chrome 2014/04/10 11:25:08 Done.
161 // streams have the same source, both video streams should stop. If they do,
162 // the test succeeds.
163 function twoGetUserMediaAndStop(constraints) { 161 function twoGetUserMediaAndStop(constraints) {
164 console.log('Calling Two GetUserMedia'); 162 console.log('Calling Two GetUserMedia');
165 navigator.webkitGetUserMedia( 163 navigator.webkitGetUserMedia(
166 constraints, 164 constraints,
167 function(stream) { 165 function(stream) {
168 displayAndDetectVideo(stream, requestSecondGetUserMedia); 166 displayAndDetectVideo(stream, requestSecondGetUserMedia);
169 }, 167 },
170 failedCallback); 168 failedCallback);
171 var requestSecondGetUserMedia = function() { 169 var requestSecondGetUserMedia = function() {
172 navigator.webkitGetUserMedia( 170 navigator.webkitGetUserMedia(
173 constraints, 171 constraints,
174 function(stream) { 172 function(stream) {
175 displayIntoVideoElement(stream, 173 displayIntoVideoElement(stream,
176 stopStreamAndVerifyAllLocalViewsDontPlayVideo, 'local-view-2'); 174 function() {
175 stopBothVideoTracksAndVerify(stream);
176 },
177 'local-view-2');
177 }, 178 },
178 failedCallback); 179 failedCallback);
179 }; 180 };
180 181
181 var stopStreamAndVerifyAllLocalViewsDontPlayVideo = function() { 182 var stopBothVideoTracksAndVerify = function(stream) {
182 gLocalStream.getVideoTracks()[0].stop(); 183 stream.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'); 184 waitForVideoToStop('local-view-2');
185 // Make sure the original track is still playing and then stop it.
186 displayAndDetectVideo(gLocalStream, stopVideoTrack);
188 }; 187 };
189 } 188 }
190 189
191 function failedCallback(error) { 190 function failedCallback(error) {
192 failTest('GetUserMedia call failed with code ' + error.code); 191 failTest('GetUserMedia call failed with code ' + error.code);
193 } 192 }
194 193
195 function plugStreamIntoVideoElement(stream, videoElement) { 194 function plugStreamIntoVideoElement(stream, videoElement) {
196 gLocalStream = stream; 195 gLocalStream = stream;
197 var localStreamUrl = URL.createObjectURL(stream); 196 var localStreamUrl = URL.createObjectURL(stream);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 <tr> 385 <tr>
387 <td><video width="320" height="240" id="local-view-2" 386 <td><video width="320" height="240" id="local-view-2"
388 autoplay="autoplay"></video></td> 387 autoplay="autoplay"></video></td>
389 <!-- Canvases are named after their corresponding video elements. --> 388 <!-- Canvases are named after their corresponding video elements. -->
390 <td><canvas width="320" height="240" id="local-view-2-canvas" 389 <td><canvas width="320" height="240" id="local-view-2-canvas"
391 style="display:none"></canvas></td> 390 style="display:none"></canvas></td>
392 </tr> 391 </tr>
393 </table> 392 </table>
394 </body> 393 </body>
395 </html> 394 </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