OLD | NEW |
---|---|
1 <html> | 1 <!DOCTYPE html> |
2 <head> | 2 <title>Test that media autoplay should not work if user gesture is required for playback.</title> |
3 <title>Test that media autoplay should not work if user gesture is requi red for playback</title> | 3 <script src="../resources/testharness.js"></script> |
4 <script src=media-file.js></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 5 <script src="media-file.js"></script> |
6 (Please avoid writing new tests using video-test.js) --> | 6 <script> |
7 <script src=video-test.js></script> | 7 async_test(function(t) { |
8 <script> | 8 internals.settings.setMediaPlaybackRequiresUserGesture(true); |
9 if (window.internals) | 9 var video = document.createElement("video"); |
10 window.internals.settings.setMediaPlaybackRequiresUserGesture(tr ue); | 10 video.autoplay = true; |
11 video.src = findMediaFile("video", "content/test"); | |
12 assert_true(video.paused); | |
11 | 13 |
12 function testPlay() | 14 video.onplay = t.unreached_func(); |
13 { | |
14 failTest("play event should not fire without user gesture."); | |
15 } | |
16 | 15 |
17 function testPaused() | 16 video.oncanplaythrough = t.step_func(function() { |
18 { | 17 setTimeout(t.step_func_done(testPaused), 100); |
fs
2016/06/11 18:59:50
Maybe fold testPaused into this as an anonymous fu
Srirama
2016/06/12 09:51:04
Done.
| |
19 testExpected("video.paused", true); | 18 }); |
20 endTest(); | |
21 } | |
22 | 19 |
23 function canplaythrough() | 20 function testPaused() { |
24 { | 21 assert_true(video.paused); |
25 setTimeout(testPaused, 100); | 22 } |
26 } | 23 }); |
27 | 24 </script> |
28 function start() | |
29 { | |
30 findMediaElement(); | |
31 video.src = findMediaFile("video", "content/test"); | |
32 testExpected("video.paused", true); | |
33 waitForEvent('canplaythrough', canplaythrough); | |
34 waitForEvent('play', testPlay); | |
35 } | |
36 </script> | |
37 </head> | |
38 | |
39 <body onload="start()"> | |
40 <p>Test that media autoplay should not work if user gesture is required for playback.</p> | |
41 <video controls autoplay></video> | |
fs
2016/06/11 18:59:50
Previously this test used a <video> in the documen
Srirama
2016/06/12 09:51:04
Done. Problem is we need to execute internals sett
fs
2016/06/12 13:55:39
Acknowledged. I guess an alternate way would be to
Srirama
2016/06/12 15:29:32
Done.
| |
42 </body> | |
43 </html> | |
OLD | NEW |