Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / menu-key-context-menu.html
blob586d182d1835610bf03992353490617fb8199ecf
1 <html>
2 <head>
3 <title>
4 Test for contextmenu event target
5 </title>
6 </head>
7 <body onload="test()">
8 <p>This test checks if contextmenu event target is correct when triggered from menu key.</p>
9 <a href="" id="anchor" oncontextmenu="handleContextMenu(event);">Test</a>
10 <div id="result">FAIL</div>
11 <script>
12 var count = 0;
13 function handleContextMenu(e) {
14 count++;
15 if(count === 2)
16 document.getElementById("result").innerHTML = "PASS";
17 return false;
20 function test() {
21 if (window.testRunner)
22 testRunner.dumpAsText();
24 if (!window.eventSender)
25 return;
27 var anchor = document.getElementById("anchor");
29 var r = anchor.getBoundingClientRect();
30 var x = (r.left + r.right) / 2
31 var y = (r.top + r.bottom) / 2;
32 eventSender.mouseMoveTo(x, y);
33 eventSender.contextClick();
34 // Esc key to hide context menu
35 eventSender.keyDown("escape");
36 anchor.focus();
37 eventSender.keyDown("menu");
40 </script>
41 </body>
42 </html>