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

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

Issue 1073783003: Add tests for closing a frame within the scope of a getusermedia callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 setAllEventsOccuredHandler(function() { 9 setAllEventsOccuredHandler(function() {
10 reportTestSuccess(); 10 reportTestSuccess();
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 'local-view-2', 274 'local-view-2',
275 function() { 275 function() {
276 validateFrameRate('local-view-2', expected_frame_rate2, 276 validateFrameRate('local-view-2', expected_frame_rate2,
277 validateFrameRateCallback); 277 validateFrameRateCallback);
278 }); 278 });
279 }, 279 },
280 failedCallback); 280 failedCallback);
281 } 281 }
282 } 282 }
283 283
284 function getUserMediaInIframeAndCloseInSuccessCb(constraints) {
285 var iframe = document.createElement('iframe');
286 iframe.onload = onIframeLoaded;
287 document.body.appendChild(iframe);
288 iframe.src = window.location;
289
290 function onIframeLoaded() {
291 var iframe = window.document.querySelector('iframe');
292 iframe.contentWindow.navigator.webkitGetUserMedia(
293 constraints,
294 function (stream) {
295 // Remove the iframe from the parent within the callback scope.
296 window.parent.document.querySelector('iframe').remove();
297 window.parent.reportTestSuccess();
298 },
299 window.parent.failedCallback);
300 }
301 }
302
303 function getUserMediaInIframeAndCloseInFailureCb(constraints) {
304 var iframe = document.createElement('iframe');
305 iframe.onload = onIframeLoaded;
306 document.body.appendChild(iframe);
307 iframe.src = window.location;
308
309 function onIframeLoaded() {
310 var iframe = window.document.querySelector('iframe');
311 iframe.contentWindow.navigator.webkitGetUserMedia(
312 constraints,
313 function (stream) {
314 window.parent.failTest('GetUserMedia call succeeded unexpectedly.');
315 },
316 function (error) {
317 // Remove the iframe from the parent within the callback scope.
318 window.parent.document.querySelector('iframe').remove();
319 window.parent.reportTestSuccess();
320 });
321 }
322 }
323
284 function failedCallback(error) { 324 function failedCallback(error) {
285 failTest('GetUserMedia call failed with code ' + error.code); 325 failTest('GetUserMedia call failed with code ' + error.code);
286 } 326 }
287 327
288 function attachMediaStream(stream, videoElement) { 328 function attachMediaStream(stream, videoElement) {
289 var localStreamUrl = URL.createObjectURL(stream); 329 var localStreamUrl = URL.createObjectURL(stream);
290 $(videoElement).src = localStreamUrl; 330 $(videoElement).src = localStreamUrl;
291 } 331 }
292 332
293 function detectVideoInLocalView1(stream, callback) { 333 function detectVideoInLocalView1(stream, callback) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 </tr> 512 </tr>
473 <tr> 513 <tr>
474 <td><video id="local-view-2" width="320" height="240" autoplay 514 <td><video id="local-view-2" width="320" height="240" autoplay
475 style="display:none"></video></td> 515 style="display:none"></video></td>
476 <td><canvas id="local-view-2-canvas" width="320" height="240" 516 <td><canvas id="local-view-2-canvas" width="320" height="240"
477 style="display:none"></canvas></td> 517 style="display:none"></canvas></td>
478 </tr> 518 </tr>
479 </table> 519 </table>
480 </body> 520 </body>
481 </html> 521 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698