[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.22
[framework/web/webkit-efl.git] / LayoutTests / fast / events / media-focus-in-standalone-media-document.html
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <script src="../../media/media-file.js"></script>
5         <script src="../../media/video-test.js"></script>
6         <script type="text/javascript">
7             var videoElement;
8             var standaloneMediaDocument;
9             var skipOnFirstEmptyLoad = 0;
10
11             function frameLoaded()
12             {
13                 if (++skipOnFirstEmptyLoad == 1)
14                     return;
15
16                 standaloneMediaDocument = document.getElementById("videoframe").contentDocument;
17                 videoElement = standaloneMediaDocument.querySelector("video");
18
19                 videoElement.addEventListener('click',function(){
20                     consoleWrite("*** Video element clicked.");
21                 },false);
22
23                 testFocus();
24                 testFocusbyMouseClick();
25                 consoleWrite("");
26                 endTest();
27             }
28
29             function testFocus()
30             {
31                 consoleWrite("<br>*** Should not focus video element by calling focus() method.");
32                 videoElement.focus();
33                 testExpected("standaloneMediaDocument.activeElement", videoElement, "!=");
34             }
35
36             function testFocusbyMouseClick()
37             {
38                 // Simulate click event to try focus video element.
39                 consoleWrite("<br>*** Should not focus video element by mouse click.");
40                 var click = document.createEvent("MouseEvents");
41                 click.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, document);
42                 videoElement.dispatchEvent(click);
43                 testExpected("standaloneMediaDocument.activeElement", videoElement, "!=");
44             }
45         </script>
46     </head>
47     <body>
48         <p>
49             This tests that  media element in a standalone media document cannot be focused directly using focus() method or by mouse click.
50         </p>
51         <iframe id="videoframe" width=380 height=330 onload="frameLoaded()"></iframe>
52         <script type="text/javascript">
53             document.getElementById("videoframe").src = "../../media/" + findMediaFile("video", "content/test");
54         </script>
55     </body>
56 </html>