Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / context-menu-on-long-press.html
blob6a46c7c03d8e4fc6863e5a7584632eef2b685e68
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../../resources/js-test.js"></script>
5 <style>
6 #empty {
7 width: 100px;
8 height: 50px;
10 </style>
11 </head>
12 <body onload="test()">
13 <p>This test checks that the context menu is shown on long press gesture.</p>
14 <div id="empty"></div>
15 <div id="console"></div>
16 <script>
17 "use strict";
19 var eventSequence = "";
20 var testResult=""
22 function runTest(x, y, mouseUpFlag) {
23 eventSequence = "Event sequence:";
24 testResult="FAIL";
25 internals.settings.setShowContextMenuOnMouseUp(mouseUpFlag);
26 eventSender.gestureLongPress(x, y);
28 debug("showContextMenuOnMouseUp = " + mouseUpFlag)
29 debug(eventSequence);
30 debug(testResult);
31 debug("");
34 function test()
36 if (window.testRunner)
37 testRunner.dumpAsText();
39 document.oncontextmenu = function() {
40 testResult = "PASS: Context Menu event seen.";
42 for (let evtType of ["contextmenu", "mouseover", "mousemove", "mouseout",
43 "mouseenter", "mouseleave", "mouseup", "mousedown"]) {
44 document.addEventListener(evtType, function(e) {
45 eventSequence += " " + e.type;
46 });
49 var empty = document.getElementById("empty");
51 var x = empty.offsetParent.offsetLeft + empty.offsetLeft + 4;
52 var y = empty.offsetParent.offsetTop + empty.offsetTop + empty.offsetHeight / 2;
54 if (!window.eventSender)
55 return;
57 if (!eventSender.gestureLongPress) {
58 debug("gestureLongPress not implemented by this platform");
59 return;
62 debug("");
63 runTest(x, y, true);
64 runTest(x, y, false);
66 </script>
67 </body>
68 </html>