blob: 01ceb7465ebaa3165548b4f537e76a4a0223c0a5 [file] [log] [blame]
<html>
<head>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setCanOpenWindows();
testRunner.setPopupBlockingEnabled(true);
testRunner.setCloseRemainingWindowsWhenComplete(true);
testRunner.waitUntilDone();
}
function test() {
if (!window.testRunner)
return;
// Record current window count.
window.windowCount = window.testRunner.windowCount();
console.log("window count: " + window.testRunner.windowCount());
// Send a mouse-click event to set the input focus to the test plugin.
eventSender.mouseMoveTo(0, 0);
eventSender.mouseMoveTo(20, 20);
eventSender.mouseDown();
eventSender.mouseUp();
}
// This function will be called when plugin receives a mousedown event.
function popup_by_mousedown() {
window.open("about:blank", "_blank");
// Check the new opened window and logging the result.
console.log("window count: " + window.testRunner.windowCount());
if (window.testRunner.windowCount() == (window.windowCount + 1)) {
document.getElementById("mousedown_output").innerHTML = "PASSED";
window.windowCount++;
}
setTimeout(send_key_to_plugin, 100);
}
function send_key_to_plugin() {
// Send keyboard events to the plugin.
eventSender.mouseMoveTo(0, 0);
eventSender.mouseMoveTo(60, 60);
eventSender.mouseDown();
eventSender.mouseUp();
eventSender.keyDown('p');
}
// This function will be called when plugin receives a keydown event.
function popup_by_keydown() {
// Open a new window.
window.open("about:blank", "_blank");
// Check the new opened window and logging the result.
console.log("window count: " + window.testRunner.windowCount());
if (window.testRunner.windowCount() == (window.windowCount + 1))
document.getElementById("keydown_output").innerHTML = "PASSED";
// Wait for plugin stopping and ending this test.
setTimeout(end_test, 100);
}
function end_test() {
// Change focus back to window to stop the plugin event logging.
window.focus();
// Close the test.
setTimeout(function() {testRunner.notifyDone();}, 1);
}
</script>
</head>
<body onload="internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(); test();">
<embed type="application/x-blink-deprecated-test-plugin" width=100 height=40 mousedownscript="popup_by_mousedown()" windowedplugin="false"></embed><br>
<embed type="application/x-blink-deprecated-test-plugin" width=100 height=40 keydownscript="popup_by_keydown()" windowedplugin="false"></embed><br>
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>
Opening window by mouse down is <span id="mousedown_output">FAILED</span><br>
Opening window by key down is <span id="keydown_output">FAILED</span>
</body>
</html>