upload tizen1.0 source
[framework/web/webkit-efl.git] / LayoutTests / media / context-menu-actions.html
1 <html>
2 <head>
3         <script src="media-file.js"></script>
4         <script src=video-test.js></script>
5         <script>
6
7             function playing()
8             {
9                 if (window.layoutTestController) {
10                     if (!window.eventSender) {
11                         layoutTestController.dumpAsText();
12                         endTest();
13                         return;
14                     }
15                 } else {
16                     endTest();
17                     return;
18                 }
19
20                 findMediaElement();
21
22                 var x, y, items;
23                 x = video.offsetParent.offsetLeft + video.offsetLeft + video.offsetWidth / 2;
24                 y = video.offsetParent.offsetTop + video.offsetTop + video.offsetHeight / 2;
25                 eventSender.mouseMoveTo(x, y);
26                 items = eventSender.contextClick();
27
28
29                 for (var i = 0; i < items.length; i++)
30                 {
31                     if (items[i].title.match("Controls")) {
32                        testExpected("video.controls", true, '==');
33                        consoleWrite("Toggling media controls");
34                        items[i].click();
35                        testExpected("video.controls", false, '==');
36                        consoleWrite("");
37                     }
38
39                     if (items[i].title.match("Pause")) {
40                        testExpected("video.paused", false, '==');
41                        consoleWrite("Toggling play state");
42                        items[i].click();
43                        testExpected("video.paused", true, '==');
44                        consoleWrite("");
45                     }
46
47                     if (items[i].title.match("Loop")) {
48                        testExpected("video.loop", false, '==');
49                        consoleWrite("Toggling loop state");
50                        items[i].click();
51                        testExpected("video.loop", true, '==');
52                        consoleWrite("");
53                     }
54
55                     if (items[i].title.match("Mute")) {
56                        testExpected("video.muted", false, '==');
57                        consoleWrite("Toggling mute state");
58                        items[i].click();
59                        testExpected("video.muted", true, '==');
60                        consoleWrite("");
61                     }
62
63                     if (items[i].title.match("Fullscreen") && video.webkitSupportsFullscreen) {
64                        testExpected("video.webkitDisplayingFullscreen", false, '==');
65                        consoleWrite("Toggling fullscreen state");
66                        items[i].click();
67                        testExpected("video.webkitDisplayingFullscreen", true, '==');
68                        consoleWrite("");
69                     }
70
71                     // TODO: test copy link location and open in new window.
72                  }
73                  layoutTestController.dumpAsText();
74                  endTest();
75             }
76
77             function start()
78             {
79                 findMediaElement();
80                 waitForEvent('play', playing);
81                 run("video.src = '" + findMediaFile("video", "content/test") + "'");
82             }
83
84        </script>
85 </head>
86 <body onload="start()">
87     <p>Test the various actions available in the HTML5 media element context-menu.</p>
88     <video id="video" autoplay controls></video>
89 </body>
90 </html>
91