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