Merge "[CherryPick] [WEBGL] Rename WEBKIT_WEBGL_compressed_texture_s3tc to WEBGL_comp...
[framework/web/webkit-efl.git] / LayoutTests / plugins / plugin-initiate-popup-window.html
1 <html>
2 <head>
3 <script>
4 if (window.testRunner) {
5     testRunner.dumpAsText();
6     testRunner.setCanOpenWindows();
7     testRunner.setPopupBlockingEnabled(true);
8     testRunner.setCloseRemainingWindowsWhenComplete(true);
9     testRunner.waitUntilDone();
10 }
11
12 function test() {
13     if (!window.testRunner)
14         return;
15     // Record current window count.
16     window.windowCount = window.testRunner.windowCount();
17     console.log("window count: " + window.testRunner.windowCount());
18     // Send a mouse-click event to set the input focus to the test plug-in.
19     eventSender.mouseMoveTo(0, 0);
20     eventSender.mouseMoveTo(20, 20);
21     eventSender.mouseDown();
22     eventSender.mouseUp();
23 }
24
25 // This function will be called when plugin receives a mousedown event.
26 function popup_by_mousedown() {
27     // Open a new window.
28     window.open("data:text/html\, open new window by mouse down", "_blank");
29     // Check the new opened window and logging the result.
30     console.log("window count: " + window.testRunner.windowCount());
31     if (window.testRunner.windowCount() == (window.windowCount + 1)) {
32         document.getElementById("mousedown_output").innerHTML = "PASSED";
33         window.windowCount++;
34     }
35    setTimeout(send_key_to_plugin, 100);
36 }
37
38 function send_key_to_plugin() {
39     // Send keyboard events to the plug-in.
40     eventSender.mouseMoveTo(0, 0);
41     eventSender.mouseMoveTo(60, 60);
42     eventSender.mouseDown();
43     eventSender.mouseUp();
44     eventSender.keyDown('p');
45 }
46
47 // This function will be called when plugin receives a keydown event.
48 function popup_by_keydown() {
49     // Open a new window.
50     window.open("data:text/html\, open new window by key down", "_blank");
51     // Check the new opened window and logging the result.
52     console.log("window count: " + window.testRunner.windowCount());
53     if (window.testRunner.windowCount() == (window.windowCount + 1))
54         document.getElementById("keydown_output").innerHTML = "PASSED";
55     // Wait for plugin stopping and ending this test.
56     setTimeout(end_test, 100);
57 }
58
59 function end_test() {
60     // Change focus back to window to stop the plugin event logging.
61     window.focus();
62     // Close the test.
63      setTimeout(function() {testRunner.notifyDone();}, 1);
64 }
65 </script>
66 </head>
67 <body onload="window.setTimeout(test, 0);">
68 <embed type="application/x-webkit-test-netscape" width=100 height=40 evaluatescript="mouse::popup_by_mousedown()" windowedplugin="false"></embed><br>
69 <embed type="application/x-webkit-test-netscape" width=100 height=40 evaluatescript="key::popup_by_keydown()" windowedplugin="false"></embed><br>
70 Specify a script and a mouse/keyboard event to the plugin. The specified script will be evaluated in the browser when the specified event is received by the plugin. The test is for bug https://bugs.webkit.org/show_bug.cgi?id=41292.<br>
71 Opening window by mouse down is <span id="mousedown_output">FAILED</span><br>
72 Opening window by key down is <span id="keydown_output">FAILED</span>
73 </body>
74 </html>