upload tizen1.0 source
[framework/web/webkit-efl.git] / LayoutTests / media / video-click-dblckick-standalone.html
1 <html>
2     <head>
3         <script src=media-file.js></script>
4         <script>
5         if (window.layoutTestController) {
6             layoutTestController.dumpAsText();
7             layoutTestController.waitUntilDone();
8         }
9
10         var video;
11         function log(msg)
12         {
13             document.getElementById('console').appendChild(document.createTextNode(msg + "\n"));
14         }
15         
16         function test()
17         {
18             video = document.getElementById('fr').contentDocument.getElementsByTagName('video')[0];
19             if (video.readyState >= 4)
20                 test2();
21             else
22                 video.addEventListener('canplaythrough', test2);
23         }
24         function test2()
25         {
26             var doubleClick = document.createEvent("MouseEvents");
27             doubleClick.initMouseEvent("dblclick", true, true, window, 2, 0, 0, 0, 0, false, false, false, false, 0, document);
28             var click = document.createEvent("MouseEvents");
29             click.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, document);
30             video.dispatchEvent(doubleClick);
31             if (!video.paused)
32                 log("PASS: video is playing");
33             else
34                 log("FAIL: video should be playing");
35             video.dispatchEvent(click);
36             if (video.paused)
37                 log("PASS: video is paused");
38             else
39                 log("FAIL: video should be paused");
40
41             if (window.layoutTestController)
42                 layoutTestController.notifyDone();
43         }
44         </script>
45     </head>
46     <body>
47     <iframe id="fr"></iframe>
48     <script>
49         var frame = document.getElementById("fr");
50         frame.src = findMediaFile("video", "content/test");
51         frame.addEventListener("load", test);
52     </script>
53     <p>This tests that clicking on a standalone video will pause and double-clicking will play.</p>
54     <pre id="console"></pre>
55     </body>
56 </html>