2 <p>This test checks that triggering the context menu selects/doesn't select as platform-appropriate.
</p>
3 <div id=
"text">Lorem ipsum
</div>
4 <div id=
"resultmac">RUNNING
</div>
5 <div id=
"resultwin">RUNNING
</div>
6 <div id=
"resultunix">RUNNING
</div>
7 <div id=
"resultandroid">RUNNING
</div>
10 function test(platform
, selectionExpected
, result
)
13 window
.getSelection().removeAllRanges();
15 internals
.settings
.setEditingBehavior(platform
);
17 var text
= document
.getElementById("text");
19 var x
= text
.offsetParent
.offsetLeft
+ text
.offsetLeft
+ 4;
20 var y
= text
.offsetParent
.offsetTop
+ text
.offsetTop
+ text
.offsetHeight
/ 2;
22 eventSender
.mouseMoveTo(x
, y
);
23 eventSender
.contextClick();
24 // esc key to kill the context menu
25 eventSender
.keyDown("escape", null);
27 var resultElement
= document
.getElementById(result
);
28 var selectionType
= window
.getSelection().type
;
29 if (selectionExpected
) {
30 if (selectionType
== "Range")
31 resultElement
.innerHTML
= "SUCCESS";
33 resultElement
.innerHTML
= "FAILURE: There should be a selection.";
35 if (selectionType
== "Range")
36 resultElement
.innerHTML
= "FAILURE: There shouldn't be a selection.";
38 resultElement
.innerHTML
= "SUCCESS";
44 if (!window
.eventSender
|| !window
.testRunner
|| !window
.internals
)
47 testRunner
.dumpAsText();
49 test('mac', true, 'resultmac');
50 test('win', false, 'resultwin');
51 test('unix', false, 'resultunix');
52 test('android', false, 'resultandroid');