[Modern Media Controls] Turn media/modern-media-controls/ios-inline-media-controls...
[WebKit-https.git] / LayoutTests / media / require-user-gesture-to-load-video.html
1 <!DOCTYPE html><!-- webkit-test-runner [ enableModernMediaControls=false ] -->
2 <html>
3 <head>
4 <script src="media-controls.js"></script>
5 <script src="media-file.js"></script>
6 <script src="video-test.js"></script>
7 <script>
8 if (window.internals) {
9     internals.settings.setVideoPlaybackRequiresUserGesture(true);
10     internals.settings.setRequiresUserGestureToLoadVideo(true);
11 }
12
13 var didUserGesture = false;
14
15 function checkDidLoadMetadataAfterUserGesture()
16 {
17     if (didUserGesture)
18         passTest("Did load metadata after user gesture.");
19     else
20         failTest("Did load metadata without user gesture");
21 }
22
23 function performClickOnPlayButton()
24 {
25     didUserGesture = true;
26     clickPlayButton(video);
27 }
28
29 function start()
30 {
31     findMediaElement();
32     waitForEvent("loadedmetadata", checkDidLoadMetadataAfterUserGesture);
33     video.src = findMediaFile("video", "content/test");
34
35     window.setTimeout(performClickOnPlayButton, 0);
36 }
37 </script>
38 </head>
39 <body onload="start()">
40     <video id="video" controls></video>
41 </body>
42 </html>