Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / popup-blocked-from-fake-user-gesture.html
blob6b41b7101b96032c2de523392cbd1d0b0336ed66
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 </head>
5 <body>
6 <button id="test" onclick="clickHandler()">Click Here</button>
7 <div id="console"></div>
8 <script>
9 var stolenEvent;
10 var win;
11 function clickHandler1()
13 stolenEvent = window.event;
14 win = window.open("about:blank", "blank");
15 shouldBeNonNull("win");
16 win.close();
19 function clickHandler2()
21 window.event = stolenEvent;
22 win = window.open("about:blank", "blank");
23 shouldBeUndefined("win");
26 clickHandler = clickHandler1;
28 if (window.testRunner) {
29 testRunner.dumpAsText();
30 testRunner.setCanOpenWindows();
31 testRunner.setPopupBlockingEnabled(true);
32 testRunner.setCloseRemainingWindowsWhenComplete(true);
33 testRunner.waitUntilDone();
35 var button = document.getElementById("test");
37 if (window.eventSender) {
38 eventSender.mouseMoveTo(button.offsetLeft + button.offsetWidth / 2, button.offsetTop + button.offsetHeight / 2);
39 eventSender.mouseDown();
40 eventSender.mouseUp();
43 clickHandler = clickHandler2;
44 window.event = stolenEvent;
45 button.click();
47 testRunner.notifyDone();
49 </script>
50 </body>
51 </html>