Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | |
| 3 <head> | |
|
esprehn
2016/06/21 21:28:41
you don't need <head> or <html>, just add <body>.
mlamouri (slow - plz ping)
2016/06/21 21:32:11
I could but having <title> outside of <head> isn't
esprehn
2016/06/21 21:36:39
The <title> won't be outside the head, just like i
| |
| 2 <title>Test for autoplay of muted video</title> | 4 <title>Test for autoplay of muted video</title> |
| 5 </head> | |
| 6 <body> | |
| 3 <script src="../resources/testharness.js"></script> | 7 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> | 8 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="media-file.js"></script> | 9 <script src="media-file.js"></script> |
| 6 <script src="media-controls.js"></script> | 10 <script src="media-controls.js"></script> |
| 7 <script> | 11 <script> |
|
esprehn
2016/06/21 21:28:41
<body> is all you need here, right before the <scr
| |
| 8 test(function() { | 12 test(function() { |
| 9 assert_true(!!window.internals | 13 assert_true(!!window.internals |
| 10 && !!window.internals.settings | 14 && !!window.internals.settings |
| 11 && !!window.internals.runtimeFlags | 15 && !!window.internals.runtimeFlags |
| 12 && !!window.eventSender, | 16 && !!window.eventSender, |
| 13 "This test only works when run as a layout test!"); | 17 "This test only works when run as a layout test!"); |
| 14 }, "Prerequisites to running the rest of the tests"); | 18 }, "Prerequisites to running the rest of the tests"); |
| 15 | 19 |
| 16 window.internals.settings.setMediaPlaybackRequiresUserGesture(true); | 20 window.internals.settings.setMediaPlaybackRequiresUserGesture(true); |
| 17 window.internals.runtimeFlags.autoplayMutedVideosEnabled = true; | 21 window.internals.runtimeFlags.autoplayMutedVideosEnabled = true; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 28 return createMutedMediaElement('video'); | 32 return createMutedMediaElement('video'); |
| 29 } | 33 } |
| 30 | 34 |
| 31 function createMutedAudioElement() { | 35 function createMutedAudioElement() { |
| 32 return createMutedMediaElement('audio'); | 36 return createMutedMediaElement('audio'); |
| 33 } | 37 } |
| 34 | 38 |
| 35 async_test(function(t) { | 39 async_test(function(t) { |
| 36 var e = createMutedVideoElement(); | 40 var e = createMutedVideoElement(); |
| 37 e.autoplay = true; | 41 e.autoplay = true; |
| 42 document.body.appendChild(e); | |
| 38 | 43 |
| 39 var expectedEvents = [ 'canplay', 'play', 'playing']; | 44 var expectedEvents = [ 'canplay', 'play', 'playing']; |
| 40 var eventWatcher = new EventWatcher(t, e, expectedEvents); | 45 var eventWatcher = new EventWatcher(t, e, expectedEvents); |
| 41 eventWatcher.wait_for(expectedEvents).then( | 46 eventWatcher.wait_for(expectedEvents).then( |
| 42 t.step_func_done(function() { | 47 t.step_func_done(function() { |
| 43 assert_false(e.paused); | 48 assert_false(e.paused); |
| 44 })); | 49 })); |
| 45 }, "Test that a muted video with an autoplay attribute autoplays."); | 50 }, "Test that a muted video with an autoplay attribute autoplays."); |
| 46 | 51 |
| 47 promise_test(function() { | 52 promise_test(function() { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 promise_test(function(t) { | 98 promise_test(function(t) { |
| 94 testRunner.setAutoplayAllowed(false); | 99 testRunner.setAutoplayAllowed(false); |
| 95 return promise_rejects( | 100 return promise_rejects( |
| 96 t, | 101 t, |
| 97 new DOMException( | 102 new DOMException( |
| 98 'play() can only be initiated by a user gesture.', | 103 'play() can only be initiated by a user gesture.', |
| 99 'NotAllowedError'), | 104 'NotAllowedError'), |
| 100 createMutedVideoElement().play()); | 105 createMutedVideoElement().play()); |
| 101 }, "Test that muted videos don't autoplay when the setting is disabled"); | 106 }, "Test that muted videos don't autoplay when the setting is disabled"); |
| 102 </script> | 107 </script> |
| 108 </body> | |
| 109 </html> | |
|
esprehn
2016/06/21 21:28:41
remove
| |
| OLD | NEW |