[Modern Media Controls] Turn media/modern-media-controls/ios-inline-media-controls...
[WebKit-https.git] / LayoutTests / media / remote-control-command-is-user-gesture.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.setMediaElementRestrictions(video, "RequireUserGestureForVideoRateChange")');
17
18                 waitForEvent('loadedmetadata', loadedmetadata, false, true, document)
19                 waitForEventAndEnd('timeupdate')
20
21                 consoleWrite('* set video.src');
22                 video.src = findMediaFile('video', 'content/test');
23             }
24
25             function loadedmetadata()
26             {
27                 consoleWrite('<br>* video.play() should fail ');
28                 run('handlePromise(video.play())');
29                 testExpected('video.paused', true);
30
31                 consoleWrite('<br>* Send a play command, it should succeed.');
32                 run("internals.postRemoteControlCommand('play')");
33                 consoleWrite('');
34             }
35
36         </script>
37     </head>
38
39     <body onload="start()">
40         <p>Test that a remote control command is treated as a user gesture.</p>
41         <video controls></video>
42     </body>
43 </html>