blob: ad279ac9d44967d9f53a8045559563502108d607 [file] [log] [blame]
commit-queue@webkit.orga0897272012-06-12 20:37:16 +00001<html>
2 <head>
3 <title>Test that media autoplay should not work if user gesture is required for playback</title>
4 <script src=media-file.js></script>
5 <script src=video-test.js></script>
6 <script>
7 if (window.internals)
8 window.internals.settings.setMediaPlaybackRequiresUserGesture(true);
9
commit-queue@webkit.orga0897272012-06-12 20:37:16 +000010 function testPlay()
11 {
commit-queue@webkit.orga0897272012-06-12 20:37:16 +000012 failTest("play event should not fire without user gesture.");
13 }
14
15 function testPaused()
16 {
17 testExpected("video.paused", true);
commit-queue@webkit.orga0897272012-06-12 20:37:16 +000018 endTest();
19 }
20
21 function canplaythrough()
22 {
commit-queue@webkit.org060f1c02012-06-14 00:40:40 +000023 setTimeout(testPaused, 100);
commit-queue@webkit.orga0897272012-06-12 20:37:16 +000024 }
25
26 function start()
27 {
28 findMediaElement();
29 video.src = findMediaFile("video", "content/test");
30 testExpected("video.paused", true);
31 waitForEvent('canplaythrough', canplaythrough);
32 waitForEvent('play', testPlay);
33 }
34 </script>
35 </head>
36
37 <body onload="start()">
38 <p>Test that media autoplay should not work if user gesture is required for playback.</p>
39 <video controls autoplay></video>
40 </body>
41</html>