Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / context-menu-on-long-tap.html
blob35cb8b8991ff63ff6d9a49da6e386cbcf7516ac7
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 long tap gesture.</p>
8 <div id="text" draggable='true'>Testing</div>
9 <div id="dragresult">FAIL</div>
10 <div id="result">FAIL</div>
11 <script>
12 function test()
14 if (window.testRunner)
15 testRunner.dumpAsText();
17 if (window.internals)
18 internals.settings.setTouchDragDropEnabled(true);
20 document.ondragstart = function() { document.getElementById("dragresult").innerHTML = "PASS"; }
21 document.oncontextmenu = function() { document.getElementById("result").innerHTML = "PASS"; }
23 var text = document.getElementById("text");
25 var x = text.offsetParent.offsetLeft + text.offsetLeft + 4;
26 var y = text.offsetParent.offsetTop + text.offsetTop + text.offsetHeight / 2;
28 if (!window.eventSender)
29 return;
30 if (eventSender.gestureLongTap) {
31 // Send long press first on the draggable div to start a drag. This
32 // will enable context menu on the subsequent long tap.
33 eventSender.gestureLongPress(x, y);
34 eventSender.gestureLongTap(x, y);
35 } else {
36 debug("gestureLongTap not implemented by this platform");
37 return;
40 </script>
41 </body>
42 </html>