Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / simulated-key-state.html
blobd594be0675b5ec58bcbb6f5527999d43f3de0961
1 <p>This tests that modifier keys are propagated to the fake mouse event created when you press return and a link has focus.</p>
2 <p>If the test succeeds, you should see six "PASS" messages below.</p>
3 <p>This is the <a id="link" href="#" onclick="checkKeyState(event)" onmousedown="checkKeyState(event)" onmouseuup="checkKeyState(event)">link</a> used for testing.</p>
4 <pre id="console">
5 </pre>
6 <script>
8 if (window.testRunner)
9 testRunner.dumpAsText();
11 var link = document.getElementById("link");
12 link.focus();
14 var expectedCtrl;
15 var expectedAlt;
16 var expectedShift;
17 var expectedMeta;
19 function test(ctrlKey, altKey, shiftKey, metaKey)
21 expectedCtrl = ctrlKey;
22 expectedAlt = altKey;
23 expectedShift = shiftKey;
24 expectedMeta = metaKey;
25 var event = document.createEvent("KeyboardEvents");
26 event.initKeyboardEvent("keydown", true, true, document.defaultView, "Enter", 0, ctrlKey, altKey, shiftKey, metaKey, false);
27 link.dispatchEvent(event);
30 function checkKeyState(event)
32 if (event.ctrlKey == expectedCtrl && event.altKey == expectedAlt && event.shiftKey == expectedShift && event.metaKey == expectedMeta)
33 document.getElementById("console").innerHTML += "PASS: " + event.type + " event had all the right key state.\n";
34 else
35 document.getElementById("console").innerHTML += "FAIL: " + event.type + " event did not have the right key state.\n";
38 test(false, false, false, false);
39 test(true, false, false, false);
40 test(false, true, false, false);
41 test(false, false, true, false);
42 test(false, false, false, true);
43 test(true, true, true, true);
45 link.blur();
47 </script>