| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/inspector-protocol-test.js"></script> | |
| 4 <script> | |
| 5 | |
| 6 window.addEventListener("keydown", logEvent); | |
| 7 window.addEventListener("keypress", logEvent); | |
| 8 window.addEventListener("keyup", logEvent); | |
| 9 | |
| 10 function logEvent(event) | |
| 11 { | |
| 12 log("-----Event-----"); | |
| 13 log("type: " + event.type); | |
| 14 if (event.altKey) | |
| 15 log("altKey"); | |
| 16 if (event.ctrlKey) | |
| 17 log("ctrlKey"); | |
| 18 if (event.metaKey) | |
| 19 log("metaKey"); | |
| 20 if (event.shiftKey) | |
| 21 log("shiftKey"); | |
| 22 if (event.keyCode) | |
| 23 log("keyCode: " + event.keyCode); | |
| 24 if (event.key) | |
| 25 log("key: " + event.key); | |
| 26 if (event.charCode) | |
| 27 log("charCode: " + event.charCode); | |
| 28 if (event.text) | |
| 29 log("text: " + event.text); | |
| 30 log(""); | |
| 31 } | |
| 32 | |
| 33 function test() | |
| 34 { | |
| 35 var events = [ | |
| 36 { | |
| 37 "type": "rawKeyDown", | |
| 38 "windowsVirtualKeyCode": 65, // VK_A | |
| 39 "key": "A" | |
| 40 }, | |
| 41 { | |
| 42 "type": "char", | |
| 43 "modifiers": 8, // shift | |
| 44 "text": "A", | |
| 45 "unmodifiedText": "a" | |
| 46 }, | |
| 47 { | |
| 48 "type": "keyUp", | |
| 49 "windowsVirtualKeyCode": 65, | |
| 50 "key": "A" | |
| 51 }, | |
| 52 { | |
| 53 "type": "char", | |
| 54 "text": "\u05E9", // Hebrew Shin (sh) | |
| 55 "unmodifiedText": "\u05E9" | |
| 56 } | |
| 57 ]; | |
| 58 | |
| 59 for (var i = 0; i < events.length; i++) | |
| 60 InspectorTest.sendCommand("Input.dispatchKeyEvent", events[i], checkResp
onse.bind(undefined, i == events.length - 1)); | |
| 61 | |
| 62 function checkResponse(isLastCommand, msg) | |
| 63 { | |
| 64 if (msg.error) | |
| 65 InspectorTest.log("Error: " + msg.error.message); | |
| 66 if (isLastCommand) | |
| 67 InspectorTest.completeTest(); | |
| 68 } | |
| 69 } | |
| 70 | |
| 71 </script> | |
| 72 </head> | |
| 73 <body onload="runTest()"> | |
| 74 </body> | |
| 75 </html> | |
| OLD | NEW |