<html>
<head>
    <title></title>
    <script src="resources/common.js"></script>
    <script>
        function test()
        {
            if (!window.testRunner)
                return;

            testRunner.dumpAsText();

            var s1 = document.getElementById("search1");
            var s2 = document.getElementById("search2");
            var s3 = document.getElementById("search3");

            var s1cancelPos = searchCancelButtonPosition(s1);
            var buttonX = s1cancelPos.x;
            var middleX = s1.offsetLeft + s1.offsetWidth / 2;

            var y2 = s2.offsetTop + s2.offsetHeight / 2;
            var y3 = s3.offsetTop + s3.offsetHeight / 2;

            eventSender.mouseMoveTo(buttonX, s1cancelPos.y);
            eventSender.mouseDown();
            eventSender.mouseMoveTo(middleX, s1cancelPos.y);
            eventSender.mouseUp();
            eventSender.leapForward(1000);

            eventSender.mouseMoveTo(middleX, y2);
            eventSender.mouseDown();
            eventSender.mouseMoveTo(buttonX, y2);
            eventSender.mouseUp();
            eventSender.leapForward(1000);

            eventSender.mouseMoveTo(buttonX, y3);
            eventSender.mouseDown();
            eventSender.mouseMoveTo(buttonX, y3);
            eventSender.mouseUp();

            var result = document.getElementById("result");
            var values = s1.value + ", " + s2.value + ", " + s3.value;
            if (values == "foo, bar, ")
                result.innerText = "PASS";
            else
                result.innerText = "FAIL (" + values + ")";
        }
    </script>
</head>
<body onload="test()">
    <p>
        Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=12618">http://bugs.webkit.org/show_bug.cgi?id=12618</a>
        REGRESSION (SearchField): Dragging across the text and releasing over the clear button clears the field</i>.
    </p>
    <p id="result">
        Cannot run interactively.
    </p>
    <input id="search1" type="search" value="foo">
    <br>
    <input id="search2" type="search" value="bar">
    <br>
    <input id="search3" type="search" value="baz">
</body>
</html>
