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

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 addExpectedEvent();
288 document.body.appendChild(iframe);
289 iframe.src = window.location;
290
291 function onIframeLoaded() {
292 var iframe = window.document.querySelector('iframe');
293 iframe.contentWindow.navigator.webkitGetUserMedia(
294 constraints,
295 function (stream) {
296 console.log("getUserMedia succeeded.");
297 // Remove the iframe from the parent within the callback scope.
298 window.parent.document.querySelector('iframe').remove();
299 console.log("Removed Iframe.");
phoglund_chromium 2015/04/09 15:05:12 Remove this log statement.
300 // Complete the test later. This will make the test fail if a crash
301 // has occurred. Otherwise, the test might falsely pass.
302 setTimeout(window.parent.eventOccured, 1);
phoglund_chromium 2015/04/09 15:05:12 Also, consider just calling testSuccessful or what
phoglund_chromium 2015/04/09 15:05:12 Can we do something more useful, like assign the s
perkj_chrome 2015/04/10 09:39:06 Done.
303 },
304 window.parent.failedCallback);
305 }
306 }
307
308 function getUserMediaInIframeAndCloseInFailureCb(constraints) {
309 var iframe = document.createElement('iframe');
310 iframe.onload = onIframeLoaded;
311 addExpectedEvent();
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 console.log("getUserMedia failed.");
324 // Remove the iframe from the parent within the callback scope.
325 window.parent.document.querySelector('iframe').remove();
326 console.log("Removed Iframe.");
phoglund_chromium 2015/04/09 15:05:12 Remove
327 // Complete the test later. This will make the test fail if a crash
328 // has occurred. Otherwise, the test might falsely pass.
329 setTimeout(window.parent.eventOccured, 1);
phoglund_chromium 2015/04/09 15:05:12 Same thing here.
perkj_chrome 2015/04/10 09:39:06 moved this to reportTestSuccess to fix all test ca
330 });
331 }
332 }
333
284 function failedCallback(error) { 334 function failedCallback(error) {
285 failTest('GetUserMedia call failed with code ' + error.code); 335 failTest('GetUserMedia call failed with code ' + error.code);
286 } 336 }
287 337
288 function attachMediaStream(stream, videoElement) { 338 function attachMediaStream(stream, videoElement) {
289 var localStreamUrl = URL.createObjectURL(stream); 339 var localStreamUrl = URL.createObjectURL(stream);
290 $(videoElement).src = localStreamUrl; 340 $(videoElement).src = localStreamUrl;
291 } 341 }
292 342
293 function detectVideoInLocalView1(stream, callback) { 343 function detectVideoInLocalView1(stream, callback) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 </tr> 522 </tr>
473 <tr> 523 <tr>
474 <td><video id="local-view-2" width="320" height="240" autoplay 524 <td><video id="local-view-2" width="320" height="240" autoplay
475 style="display:none"></video></td> 525 style="display:none"></video></td>
476 <td><canvas id="local-view-2-canvas" width="320" height="240" 526 <td><canvas id="local-view-2-canvas" width="320" height="240"
477 style="display:none"></canvas></td> 527 style="display:none"></canvas></td>
478 </tr> 528 </tr>
479 </table> 529 </table>
480 </body> 530 </body>
481 </html> 531 </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