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

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
« no previous file with comments | « content/browser/media/webrtc_getusermedia_browsertest.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 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 // This function enqueues reporting test success, rather than doing
298 // it directly. We do this so we catch crashes that occur in the
299 // current execution context, but after reportTestSuccess is
300 // invoked.
301 setTimeout(function () {
302 window.parent.reportTestSuccess();
303 }, 0);
304 },
305 window.parent.failedCallback);
306 }
307 }
308
309 function getUserMediaInIframeAndCloseInFailureCb(constraints) {
310 var iframe = document.createElement('iframe');
311 iframe.onload = onIframeLoaded;
312 document.body.appendChild(iframe);
313 iframe.src = window.location;
314
315 function onIframeLoaded() {
316 var iframe = window.document.querySelector('iframe');
317 iframe.contentWindow.navigator.webkitGetUserMedia(
318 constraints,
319 function (stream) {
320 window.parent.failTest('GetUserMedia call succeeded unexpectedly.');
321 },
322 function (error) {
323 // Remove the iframe from the parent within the callback scope.
324 window.parent.document.querySelector('iframe').remove();
325 // This function enqueues reporting test success, rather than doing
326 // it directly. We do this so we catch crashes that occur in the
327 // current execution context, but after reportTestSuccess is
328 // invoked.
329 setTimeout(function () {
330 window.parent.reportTestSuccess();
331 }, 0);
332 });
333 }
334 }
335
284 function failedCallback(error) { 336 function failedCallback(error) {
285 failTest('GetUserMedia call failed with code ' + error.code); 337 failTest('GetUserMedia call failed with code ' + error.code);
286 } 338 }
287 339
288 function attachMediaStream(stream, videoElement) { 340 function attachMediaStream(stream, videoElement) {
289 var localStreamUrl = URL.createObjectURL(stream); 341 var localStreamUrl = URL.createObjectURL(stream);
290 $(videoElement).src = localStreamUrl; 342 $(videoElement).src = localStreamUrl;
291 } 343 }
292 344
293 function detectVideoInLocalView1(stream, callback) { 345 function detectVideoInLocalView1(stream, callback) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 </tr> 524 </tr>
473 <tr> 525 <tr>
474 <td><video id="local-view-2" width="320" height="240" autoplay 526 <td><video id="local-view-2" width="320" height="240" autoplay
475 style="display:none"></video></td> 527 style="display:none"></video></td>
476 <td><canvas id="local-view-2-canvas" width="320" height="240" 528 <td><canvas id="local-view-2-canvas" width="320" height="240"
477 style="display:none"></canvas></td> 529 style="display:none"></canvas></td>
478 </tr> 530 </tr>
479 </table> 531 </table>
480 </body> 532 </body>
481 </html> 533 </html>
OLDNEW
« no previous file with comments | « content/browser/media/webrtc_getusermedia_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698