<html>
    <head>
        <script>
            var mouseDownCount;
            var log = function(msg)
            {
                document.getElementById("console").appendChild(document.createTextNode(msg + "\n"));
            }
            function test()
            {
                mouseDownCount = 0;
                
                if (window.testRunner)
                    testRunner.dumpAsText();

                var sf = document.getElementById("search");

                var buttonX = sf.offsetLeft + sf.offsetWidth - 6;
                var middleX = sf.offsetLeft + sf.offsetWidth / 2;

                var y = sf.offsetTop + sf.offsetHeight / 2;

                if (window.testRunner) {
                    eventSender.mouseMoveTo(buttonX, y);
                    eventSender.mouseDown();
                    eventSender.mouseUp();

                    eventSender.mouseMoveTo(middleX, y);
                    eventSender.mouseDown();
                    eventSender.mouseUp();
                    
                    if (mouseDownCount == 2)
                        log("Test Passed");
                    else
                        log("Test Failed");
                }
            }
        </script>
    </head>
    <body onload="test()">
        This tests that clicking on the hidden cancel button won't start capturing mouse events.  To run this test manually, click where the 
        cancel button would be, and then click in the middle of the field.  If you see two "onmousedown" strings logged, then the test passes.<br>
        <input type="search" id="search" onmousedown="mouseDownCount++; log('onmousedown')"/>
        <pre id="console"></pre>
    </body>
</html>
