chromium/third_party/blink/web_tests/fast/forms/text/input-select-on-click.html

<html>
<head>
<script>
function test() {
    if (window.testRunner)
        testRunner.dumpAsText();
    var tf = document.getElementById('tf');
    var x = tf.offsetLeft + tf.offsetWidth / 2;
    var y = tf.offsetTop + tf.offsetHeight / 2;
    if (window.eventSender) {
        eventSender.mouseMoveTo(x, y);
        eventSender.mouseDown();
        eventSender.mouseUp();
    }
    if (tf.selectionStart == 0 && tf.selectionEnd == 10) { // ;
        document.getElementById("result").innerHTML = "PASS";
    } else {
        document.getElementById("result").innerHTML = "FAIL: selection start is "
            + tf.selectionStart + " and end is " + tf.selectionEnd + ".";
    }
}
</script>
</head>
<body onload="test()">
<p>Tests behavior of code that calls select() inside an onclick handler. The entire field should end up selected.</p>
<p>The test runs only under DumpRenderTree with eventSender; if you test by hand the test result below will say FAIL.</p>
<p><input type="text" id="tf" onclick="this.select()" value="input text"></input></p>
<p id="result">TEST NOT RUN YET</p>
</body>
</html>