commit-queue@webkit.org | a089727 | 2012-06-12 20:37:16 +0000 | [diff] [blame] | 1 | <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.org | a089727 | 2012-06-12 20:37:16 +0000 | [diff] [blame] | 10 | function testPlay() |
| 11 | { |
commit-queue@webkit.org | a089727 | 2012-06-12 20:37:16 +0000 | [diff] [blame] | 12 | failTest("play event should not fire without user gesture."); |
| 13 | } |
| 14 | |
| 15 | function testPaused() |
| 16 | { |
| 17 | testExpected("video.paused", true); |
commit-queue@webkit.org | a089727 | 2012-06-12 20:37:16 +0000 | [diff] [blame] | 18 | endTest(); |
| 19 | } |
| 20 | |
| 21 | function canplaythrough() |
| 22 | { |
commit-queue@webkit.org | 060f1c0 | 2012-06-14 00:40:40 +0000 | [diff] [blame] | 23 | setTimeout(testPaused, 100); |
commit-queue@webkit.org | a089727 | 2012-06-12 20:37:16 +0000 | [diff] [blame] | 24 | } |
| 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> |