<!DOCTYPE html><!-- webkit-test-runner [ JavaScriptCanOpenWindowsAutomatically=false ] -->
<html>
    <body>
        <p>
            Test that a forwarded user gesture can be consumed by any timeout,
            not just the first.
        </p>
        <button id="button" onclick="popup()">Click Here</button>
        <div id="console"></div>
        <script>
            function timer1() {
            }
            function timer2() {
                var win = window.open("about:blank", "window");
                if (!win)
                    document.getElementById("console").innerText = "FAILED";
                else
                    document.getElementById("console").innerText = "PASSED";
                if (window.testRunner)
                    testRunner.notifyDone();
            }

            function popup() {
                setTimeout(timer1, 0);
                setTimeout(timer2, 10);
            }

            if (window.testRunner) {
                testRunner.dumpAsText();
                testRunner.waitUntilDone();

                var button = document.getElementById("button");

                if (window.eventSender) {
                    eventSender.mouseMoveTo(button.offsetLeft + button.offsetWidth / 2, button.offsetTop + button.offsetHeight / 2);
                    eventSender.mouseDown();
                    eventSender.mouseUp();
                }
            }
        </script>
    </body>
</html>
