1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../../../resources/js-test.js"></script>
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>
19 var eventSequence
= "";
22 function runTest(x
, y
, mouseUpFlag
) {
23 eventSequence
= "Event sequence:";
25 internals
.settings
.setShowContextMenuOnMouseUp(mouseUpFlag
);
26 eventSender
.gestureLongPress(x
, y
);
28 debug("showContextMenuOnMouseUp = " + mouseUpFlag
)
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
;
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
)
57 if (!eventSender
.gestureLongPress
) {
58 debug("gestureLongPress not implemented by this platform");