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

Side by Side Diff: third_party/WebKit/LayoutTests/media/autoplay-muted.html

Issue 2051253002: Start autoplay muted videos with autoplay attribute when they are visible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reduce Created 4 years, 6 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 | « no previous file | third_party/WebKit/LayoutTests/media/autoplay-when-visible.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Test for autoplay of muted video</title> 2 <title>Test for autoplay of muted video</title>
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="media-file.js"></script> 5 <script src="media-file.js"></script>
6 <script src="media-controls.js"></script> 6 <script src="media-controls.js"></script>
7 <body>
7 <script> 8 <script>
8 test(function() { 9 test(function() {
9 assert_true(!!window.internals 10 assert_true(!!window.internals
10 && !!window.internals.settings 11 && !!window.internals.settings
11 && !!window.internals.runtimeFlags 12 && !!window.internals.runtimeFlags
12 && !!window.eventSender, 13 && !!window.eventSender,
13 "This test only works when run as a layout test!"); 14 "This test only works when run as a layout test!");
14 }, "Prerequisites to running the rest of the tests"); 15 }, "Prerequisites to running the rest of the tests");
15 16
16 window.internals.settings.setMediaPlaybackRequiresUserGesture(true); 17 window.internals.settings.setMediaPlaybackRequiresUserGesture(true);
(...skipping 11 matching lines...) Expand all
28 return createMutedMediaElement('video'); 29 return createMutedMediaElement('video');
29 } 30 }
30 31
31 function createMutedAudioElement() { 32 function createMutedAudioElement() {
32 return createMutedMediaElement('audio'); 33 return createMutedMediaElement('audio');
33 } 34 }
34 35
35 async_test(function(t) { 36 async_test(function(t) {
36 var e = createMutedVideoElement(); 37 var e = createMutedVideoElement();
37 e.autoplay = true; 38 e.autoplay = true;
39 document.body.appendChild(e);
38 40
39 var expectedEvents = [ 'canplay', 'play', 'playing']; 41 var expectedEvents = [ 'canplay', 'play', 'playing'];
40 var eventWatcher = new EventWatcher(t, e, expectedEvents); 42 var eventWatcher = new EventWatcher(t, e, expectedEvents);
41 eventWatcher.wait_for(expectedEvents).then( 43 eventWatcher.wait_for(expectedEvents).then(
42 t.step_func_done(function() { 44 t.step_func_done(function() {
43 assert_false(e.paused); 45 assert_false(e.paused);
44 })); 46 }));
45 }, "Test that a muted video with an autoplay attribute autoplays."); 47 }, "Test that a muted video with an autoplay attribute autoplays.");
46 48
47 promise_test(function() { 49 promise_test(function() {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 promise_test(function(t) { 95 promise_test(function(t) {
94 testRunner.setAutoplayAllowed(false); 96 testRunner.setAutoplayAllowed(false);
95 return promise_rejects( 97 return promise_rejects(
96 t, 98 t,
97 new DOMException( 99 new DOMException(
98 'play() can only be initiated by a user gesture.', 100 'play() can only be initiated by a user gesture.',
99 'NotAllowedError'), 101 'NotAllowedError'),
100 createMutedVideoElement().play()); 102 createMutedVideoElement().play());
101 }, "Test that muted videos don't autoplay when the setting is disabled"); 103 }, "Test that muted videos don't autoplay when the setting is disabled");
102 </script> 104 </script>
105 </body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/autoplay-when-visible.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698