| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 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> |
| 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, |
| (...skipping 15 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> |
| OLD | NEW |