<html>
<body>
<input type="text" id="text" value="some sample text">
</body>
</html>

<script>
// This test checks that if the user right clicks on selected text,
// the selected text doesn't change or get deselected.
var input = document.getElementById("text");
input.selectionStart = 5;
input.selectionEnd = 15;

if (window.testRunner) {
    var x, y;
    x = input.offsetParent.offsetLeft + input.offsetLeft + input.offsetWidth / 2;
    y = input.offsetParent.offsetTop + input.offsetTop + input.offsetHeight / 2;
    eventSender.mouseMoveTo(x, y);
    eventSender.contextClick();
}

</script>
