Add new access object callback
[framework/web/webkit-efl.git] / LayoutTests / media / video-load-require-user-gesture.html
1 <html>
2     <head>
3         <script src=media-file.js></script>
4         <script src=video-test.js></script>
5         <script>
6             var state = 0;
7             var userGestureInitiated = 0;
8
9             if (window.internals) 
10                 window.internals.settings.setMediaPlaybackRequiresUserGesture(true);
11
12             function finishTest(success)
13             {
14                 if (window.internals) 
15                     window.internals.settings.setMediaPlaybackRequiresUserGesture(false);
16
17                 if (success)
18                     endTest();
19                 else
20                     failTest("<b>Data loaded despite restriction.</b>");
21             }
22
23             function checkLoad()
24             {
25                 consoleWrite("");
26
27                 if (state == "load")
28                 {
29                     finishTest(true);
30                     return;
31                 }
32                 
33                 state = "load";
34                 consoleWrite("* Calling video.load() should not load any data.");
35                 video.load();
36                 setTimeout(checkLoad, 250);
37             }
38
39             function start()
40             {
41                 findMediaElement();
42                 waitForEvent('loadedmetadata', function() { finishTest(false) } );
43
44                 state = "src";
45                 consoleWrite("* Setting video.src, no data should load.");
46                 video.src = findMediaFile("video", "content/test");
47                 setTimeout(checkLoad, 250);
48             }
49         </script>
50     </head>
51
52     <body onload="start()">
53         <video controls preload=none></video>
54         <p>Test that video.load() should not cause media loading when user gesture is required.</p>
55     </body>
56 </html>