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

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

Issue 2039773003: [Android] Added a runtime flag to enable autoplay of muted videos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: An attempt to add a layout test. 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
OLDNEW
1 <!doctype html> 1 <!DOCTYPE html>
2 <!-- original: https://github.com/w3c/web-platform-tests/blob/6b3893bb99f70e4238 011dbcd1f380891e89ec5e/html/semantics/embedded-content-0/media-elements/autoplay .html --> 2 <title>Test for autoplay of muted video</title>
3 <title>autoplay</title> 3 <script src="../resource/testharness.js"></script>
mlamouri (slow - plz ping) 2016/06/07 15:40:14 You have a typo here I think :(
whywhat 2016/06/07 17:40:15 Right, fixed :)
4 <script src="../resources/testharness.js"></script>
5 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
6 <script src="media-file.js"></script> 5 <script src="media-file.js"></script>
7 <div id="log"></div>
8 <script> 6 <script>
9 function autoplay_test(tagName, src) 7 window.internals.settings.setMediaPlaybackRequiresUserGesture(true);
10 { 8
11 async_test(function(t) 9 async_test(function(t))
12 { 10 {
13 var e = document.createElement(tagName); 11 var e = document.createElement('video');
14 e.src = src; 12 e.src = findMediaFile('video', 'content/test');
13 e.muted = true;
15 e.autoplay = true; 14 e.autoplay = true;
16 var actual_events = []; 15 var actual_events = [];
17 var expected_events = ['canplay', 'play', 'playing', 'canplaythrough']; 16 var expected_events = ['canplay', 'play', 'playing', 'canplaythrough'];
18 expected_events.forEach(function(type) 17 expected_events.forEach(function(type)
19 { 18 {
20 e.addEventListener(type, t.step_func(function() 19 e.addEventListener(type, t.step_func(function()
21 { 20 {
22 assert_equals(e.readyState, e.HAVE_ENOUGH_DATA); 21 assert_equals(e.readyState, e.HAVE_ENOUGH_DATA);
23 assert_false(e.paused); 22 assert_false(e.paused);
24 actual_events.push(type); 23 actual_events.push(type);
25 if (type == 'canplaythrough') { 24 if (type == 'canplaythrough') {
26 assert_array_equals(actual_events, expected_events); 25 assert_array_equals(actual_events, expected_events);
27 t.done(); 26 t.done();
28 } 27 }
29 })); 28 }));
30 }); 29 });
31 }, tagName + '.autoplay'); 30 }, "muted-autoplay");
32 }
33 31
34 autoplay_test('audio', findMediaFile('audio', 'content/test')); 32 async_test(function(t))
35 autoplay_test('video', findMediaFile('video', 'content/test')); 33 {
34 if (window.internals && internals.runtimeFlags.videosAsImagesEnabled) {
35 var e = document.createElement('video');
36 e.src = findMediaFile('video', 'content/test');
37 e.muted = true;
38 e.play().then(function() { t.done(); });
39 }, "muted-playjs");
36 </script> 40 </script>
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | third_party/WebKit/Source/core/html/HTMLMediaElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698