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

Side by Side Diff: third_party/WebKit/LayoutTests/media/autoplay-from-mediastream-to-src.html

Issue 2850553002: Autoplay: use an autoplay policy setting in Blink. (Closed)
Patch Set: rebase Created 3 years, 7 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 <title>Test for autoplay of video once the media stream is set to null</title> 2 <title>Test for autoplay of video once the media stream is set to null</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> 6 <script>
7 test(function() { 7 test(function() {
8 assert_true(!!window.internals && !!window.internals.settings, 8 assert_true(!!window.internals && !!window.internals.settings,
9 "This test only works when run as a layout test!"); 9 "This test only works when run as a layout test!");
10 }, "Prerequisites to running the rest of the tests"); 10 }, "Prerequisites to running the rest of the tests");
11 11
12 window.internals.settings.setMediaPlaybackRequiresUserGesture(true); 12 window.internals.settings.setAutoplayPolicy('user-gesture-required');
13 13
14 async_test(function(t) { 14 async_test(function(t) {
15 var v = document.createElement('video'); 15 var v = document.createElement('video');
16 v.srcObject = (new AudioContext()).createMediaStreamDestination().stream ; 16 v.srcObject = (new AudioContext()).createMediaStreamDestination().stream ;
17 17
18 setTimeout(t.step_func(function() { 18 setTimeout(t.step_func(function() {
19 v.srcObject = null; 19 v.srcObject = null;
20 v.src = findMediaFile('video', 'content/test'); 20 v.src = findMediaFile('video', 'content/test');
21 21
22 v.play() 22 v.play()
23 .then(t.unreached_func('The video must not play without user ges ture.')) 23 .then(t.unreached_func('The video must not play without user ges ture.'))
24 .catch(t.step_func_done(function() { 24 .catch(t.step_func_done(function() {
25 assert_true(v.paused); 25 assert_true(v.paused);
26 })); 26 }));
27 }), 0); 27 }), 0);
28 }, 'Test that switching from MediaStream to src= does not autoplay.'); 28 }, 'Test that switching from MediaStream to src= does not autoplay.');
29 </script> 29 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698