| <!DOCTYPE html> |
| <html> |
| <body onload="test();"> |
| |
| <input id="input-box"></input> |
| <embed id="plugin" type="application/x-webkit-test-webplugin" supports-keyboard-focus="true" contentEditable="false"></embed> |
| <script> |
| |
| function focusPluginByTabKeypress() { |
| var inputBox = document.getElementById('input-box'); |
| inputBox.focus(); |
| eventSender.keyDown('\t'); |
| } |
| |
| var seenKeyup = false; |
| function onKeyup(e) { |
| if (!seenKeyup) { |
| seenKeyup = true; |
| // Change focus one more time to make sure we don't see any keypress events. |
| focusPluginByTabKeypress(); |
| } else { |
| testRunner.notifyDone(); |
| } |
| } |
| |
| function onKeypress(e) { |
| console.log('FAIL: Unexpected keypress event'); |
| testRunner.notifyDone(); |
| } |
| |
| function test() { |
| if (!window.testRunner || !window.eventSender) { |
| document.write("This test does not work in manual mode."); |
| } else { |
| testRunner.waitUntilDone(); |
| testRunner.dumpAsText(); |
| |
| // We will press tab to move the focus from <input> to the plugin. |
| // We verify that the plugin only sees keyup events, not any keypress. |
| var plugin = document.getElementById('plugin'); |
| plugin.onkeyup = onKeyup; |
| plugin.onkeypress = onKeypress; |
| focusPluginByTabKeypress(); |
| } |
| } |
| </script> |
| </body> |
| </html> |