Chromium Code Reviews| 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 function load() | |
| 7 { | |
| 8 window.internals.setFocused(false); | |
| 9 runTest(); | |
| 10 } | |
| 11 | |
| 12 function dump() | |
| 13 { | |
| 14 log("================"); | |
| 15 log("value of foo:" + document.getElementById("foo").value); | |
| 16 log("value of bar:" + document.getElementById("bar").value); | |
| 17 log("value of baz:" + document.getElementById("baz").value); | |
| 18 window.internals.setFocused(true); | |
| 19 } | |
| 20 | |
| 21 function test() | |
| 22 { | |
| 23 type("foo"); | |
| 24 typeTab(); | |
| 25 type("bar"); | |
| 26 typeTab(); | |
| 27 InspectorTest.evaluateInPage("dump()", InspectorTest.completeTest.bind(Inspe ctorTest)); | |
| 28 | |
| 29 function type(text) | |
| 30 { | |
| 31 for (var i = 0; i < text.length; ++i) { | |
| 32 var dec = text.charCodeAt(i); | |
| 33 var hex = "U+00" + Number(dec).toString(16); | |
| 34 InspectorTest.sendCommand("Input.dispatchKeyEvent", { | |
| 35 "type": "rawKeyDown", | |
| 36 "windowsVirtualKeyCode": dec, | |
| 37 "key": text[i] | |
| 38 }); | |
| 39 InspectorTest.sendCommand("Input.dispatchKeyEvent", { | |
| 40 "type": "char", | |
| 41 "text": text[i], | |
| 42 "key": text[i], | |
| 43 "unmodifiedText": text[i] | |
| 44 }); | |
| 45 InspectorTest.sendCommand("Input.dispatchKeyEvent", { | |
| 46 "type": "keyUp", | |
| 47 "windowsVirtualKeyCode": dec, | |
| 48 "key": text[i] | |
| 49 }); | |
| 50 } | |
| 51 } | |
| 52 | |
| 53 function typeTab() | |
| 54 { | |
| 55 InspectorTest.sendCommand("Input.dispatchKeyEvent", { | |
| 56 "type": "rawKeyDown", | |
| 57 "windowsVirtualKeyCode": 9, | |
| 58 "key": "Tab", | |
| 59 }); | |
| 60 InspectorTest.sendCommand("Input.dispatchKeyEvent", { | |
| 61 "type": "keyUp", | |
| 62 "windowsVirtualKeyCode": 9, | |
| 63 "key": "Tab", | |
| 64 }); | |
| 65 } | |
| 66 } | |
| 67 | |
| 68 </script> | |
| 69 </head> | |
| 70 <body onload="load()"> | |
| 71 <div id="inputs"> | |
| 72 <input onfocus="log('focus foo')" onblur="log('blur foo')" id="foo" autofocus> | |
|
allada
2017/06/26 22:02:52
I am a bit confused here, it appears that autofocu
| |
| 73 <input onfocus="log('focus bar')" onblur="log('blur bar')" id="bar"> | |
| 74 <input onfocus="log('focus baz')" onblur="log('blur baz')" id="baz"> | |
| 75 </div> | |
| 76 </body> | |
| 77 </html> | |
| OLD | NEW |