4 if (window.testRunner) {
5 testRunner.dumpAsText();
6 testRunner.setCanOpenWindows();
7 testRunner.setPopupBlockingEnabled(true);
8 testRunner.setCloseRemainingWindowsWhenComplete(true);
9 testRunner.waitUntilDone();
13 if (!window.testRunner)
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();
25 // This function will be called when plugin receives a mousedown event.
26 function popup_by_mousedown() {
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";
35 setTimeout(send_key_to_plugin, 100);
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');
47 // This function will be called when plugin receives a keydown event.
48 function popup_by_keydown() {
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);
60 // Change focus back to window to stop the plugin event logging.
63 setTimeout(function() {testRunner.notifyDone();}, 1);
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>