Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / context-menu-on-two-finger-tap.html
blobcd8c94abd4ad0c4d423e358603884fbcf1070529
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../../resources/js-test.js"></script>
5 </head>
6 <body onload="test()">
7 <p>This test checks that the context menu is shown on a two finger tap gesture.</p>
8 <div id="text">Testing</div>
9 <div id="result">FAIL</div>
10 <div id="eventSequence">Event sequence:</div>
11 <script>
12 "use strict";
14 function test()
16 if (window.testRunner)
17 testRunner.dumpAsText();
19 document.oncontextmenu = function() {
20 document.getElementById("result").innerHTML = "PASS (ContextMenu event seen)";
23 for (let evtType of ["contextmenu", "mouseover", "mousemove", "mouseout",
24 "mouseenter", "mouseleave", "mouseup", "mousedown"]) {
25 document.addEventListener(evtType, function(e) {
26 document.getElementById("eventSequence").innerHTML += " " + e.type;
27 });
30 var text = document.getElementById("text");
32 var x = text.offsetParent.offsetLeft + text.offsetLeft + 4;
33 var y = text.offsetParent.offsetTop + text.offsetTop + text.offsetHeight / 2;
35 if (!window.eventSender)
36 return;
37 if (eventSender.gestureTwoFingerTap) {
38 eventSender.gestureTwoFingerTap(x, y);
39 } else {
40 debug("gestureTwoFingerTap not implemented by this platform");
41 return;
44 </script>
45 </body>
46 </html>