| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Test for autoplay of video once the media stream is set to null</title> |
| 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="media-file.js"></script> |
| 6 <script> |
| 7 test(function() { |
| 8 assert_true(!!window.internals && !!window.internals.settings, |
| 9 "This test only works when run as a layout test!"); |
| 10 }, "Prerequisites to running the rest of the tests"); |
| 11 |
| 12 window.internals.settings.setMediaPlaybackRequiresUserGesture(true); |
| 13 |
| 14 async_test(function(t) { |
| 15 var v = document.createElement('video'); |
| 16 // getUserMedia works with autoplay video elements, play() is |
| 17 // blocked. |
| 18 v.autoplay = true; |
| 19 |
| 20 v.onplaying = function() { |
| 21 assert_false(v.paused); |
| 22 |
| 23 v.onplaying = null; |
| 24 v.srcObject = null; |
| 25 |
| 26 // Once the source has changed to anything but MediaStream, the |
| 27 // video must not be able to play. |
| 28 v.src = findMediaFile('video', 'content/test'); |
| 29 v.play() |
| 30 .then(t.unreached_func('The video must not play without user ges
ture.')) |
| 31 .catch(t.step_func_done(function() { |
| 32 assert_true(v.paused); |
| 33 })); |
| 34 }; |
| 35 |
| 36 navigator.webkitGetUserMedia( |
| 37 { video : true }, |
| 38 t.step_func(function(s) { |
| 39 v.srcObject = s; |
| 40 }), |
| 41 t.unreached_func('Can not get MediaStream object.')); |
| 42 }, 'Test that switching from MediaStream to src= does not autoplay.'); |
| 43 |
| 44 </script> |
| 45 |
| OLD | NEW |