[Modern Media Controls] Turn media/modern-media-controls/ios-inline-media-controls...
[WebKit-https.git] / LayoutTests / media / video-fullscreen-restriction-removed.html
1 <html>
2     <head>
3         <script src="media-file.js"></script>
4         <script src="video-test.js"></script>
5         <script>
6
7             function start()
8             {
9                 if (!window.internals) {
10                     failTest('This test requires window.internals.');
11                     return;
12                 }
13
14                 findMediaElement();
15
16                 run('internals.settings.setAllowsInlineMediaPlayback(false)');
17                 run('internals.setMediaElementRestrictions(video, "RequireUserGestureForFullscreen")');
18
19                 waitForEvent('canplaythrough', canplaythrough)
20                 waitForEvent('webkitfullscreenchange', fullscreenChanged, false, true, document)
21                 waitForEvent('click', clickHandler, false, true, document.getElementById('button'))
22
23                 consoleWrite('* set video.src');
24                 video.src = findMediaFile('video', 'content/test');
25                 consoleWrite('');
26             }
27
28             function canplaythrough()
29             {
30                 consoleWrite('');
31                 if (window.eventSender) {
32                     consoleWrite('* video.play() should fail ');
33                     run('video.play()');
34                     testExpected('video.paused', true);
35                     consoleWrite('');
36
37                     consoleWrite('* clicking button<br>');
38                     var button = document.getElementById('button');
39                     eventSender.mouseMoveTo(button.offsetLeft + 20, button.offsetTop + 7);
40                     eventSender.mouseDown();
41                     eventSender.mouseUp();
42                 } else {
43                     consoleWrite('* click on the "Click me!" button to proceed<br>');
44                 }
45             }
46
47             function clickHandler()
48             {
49                 consoleWrite('* video.play() should work from within a click handler');
50                 testExpected('video.paused', true);
51                 run('video.play()');
52                 consoleWrite('');
53                 failTestIn(2000);
54             }
55
56             function fullscreenChanged()
57             {
58                 testExpected('video.paused', false);
59                 consoleWrite('');
60                 endTest();
61             }
62         </script>
63     </head>
64
65     <body onload="start()">
66         <p>Test that "fullscreen requires user gesture restriction" is removed by a user gesture.</p>
67         <video controls></video>
68         <button id="button" >Click me!</button><br>
69     </body>
70 </html>