Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector-protocol / input / dispatchKeyEvent-focus.html
blob8a49686476fa7c57b865c449173183a0e6d4c2e1
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
4 <script>
6 function load()
8 window.internals.setFocused(false);
9 runTest();
12 function dump()
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);
21 function test()
23 type("foo");
24 typeTab();
25 type("bar");
26 typeTab();
27 InspectorTest.evaluateInPage("dump()", InspectorTest.completeTest.bind(InspectorTest));
29 function type(text)
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 });
52 function typeTab()
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 });
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>