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