OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
2 <head> | |
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-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); | |
dgozman
2014/05/22 12:45:47
Events you dispatch should have already focused th
vsevik
2014/05/22 13:14:40
I think this is done to make sure the test is not
| |
19 } | |
20 | |
21 function test() | |
22 { | |
23 type("foo"); | |
24 typeTab(); | |
25 type("bar"); | |
26 typeTab(); | |
27 InspectorTest.executeInPage("dump()", InspectorTest.completeTest.bind(Inspec torTest)); | |
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 "keyIdentifier": hex | |
38 }); | |
39 InspectorTest.sendCommand("Input.dispatchKeyEvent", { | |
40 "type": "char", | |
41 "text": text[i], | |
42 "unmodifiedText": text[i] | |
43 }); | |
44 InspectorTest.sendCommand("Input.dispatchKeyEvent", { | |
45 "type": "keyUp", | |
46 "windowsVirtualKeyCode": dec, | |
47 "keyIdentifier": hex | |
48 }); | |
49 } | |
50 } | |
51 | |
52 function typeTab() | |
53 { | |
54 InspectorTest.sendCommand("Input.dispatchKeyEvent", { | |
55 "type": "rawKeyDown", | |
56 "windowsVirtualKeyCode": 9, | |
57 "keyIdentifier": "U+0009" | |
58 }); | |
59 InspectorTest.sendCommand("Input.dispatchKeyEvent", { | |
60 "type": "char" | |
61 }); | |
62 InspectorTest.sendCommand("Input.dispatchKeyEvent", { | |
63 "type": "keyUp", | |
64 "windowsVirtualKeyCode": 9, | |
65 "keyIdentifier": "U+0009" | |
66 }); | |
67 } | |
68 } | |
69 | |
70 </script> | |
71 </head> | |
72 <body onload="load()"> | |
73 <div id="inputs"> | |
74 <input onfocus="log('focus foo')" onblur="log('blur foo')" id="foo" autofocus> | |
75 <input onfocus="log('focus bar')" onblur="log('blur bar')" id="bar"> | |
76 <input onfocus="log('focus baz')" onblur="log('blur baz')" id="baz"> | |
77 </div> | |
78 </body> | |
79 </html> | |
OLD | NEW |