[Modern Media Controls] Turn media/modern-media-controls/ios-inline-media-controls...
[WebKit-https.git] / LayoutTests / media / restricted-audio-playback-with-document-gesture.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4     <title>restricted-audio-playback-with-document-gesture</title>
5     <script src=media-file.js></script>
6     <script src=video-test.js></script>
7
8     <script>
9     function runTest()
10     {
11         mediaElement = document.getElementsByTagName('audio')[0];
12
13         if (window.internals) {
14             run('internals.setMediaElementRestrictions(mediaElement, "RequireUserGestureForAudioRateChange")');
15             run('internals.settings.setMediaUserGestureInheritsFromDocument(true)');
16         }
17
18         consoleWrite('Running with keyDown.');
19         runWithKeyDown(() => {
20             run("mediaElement.src = findMediaFile('audio', 'content/test')");
21             waitForEvent('canplaythrough', canplaythrough);
22             waitForEventAndFail('error');
23         }, true);
24     }
25
26     function canplaythrough()
27     {
28         run("mediaElement.play()");
29         testExpected('mediaElement.paused', false);
30         endTest();
31     }
32     </script>
33 </head>
34
35 <body onload="runTest()">
36     <p>Test that, when RequireUserGestureForAudioRateChange is set along with MediaUserGestureInheritsForDocument, a user gesture in the document will allow future media playback requests to succeed.</p>
37     <audio controls autoplay></audio>
38 </body>
39 </html>
40