Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / popup-allowed-from-gesture-only-once.html
blob3fc890f3b4c3ef3c5482310660b5ae9d6e5e319d
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <p>
5 Test that only a single popup is allowed in response to a single
6 user action. The test passes if only one popup is created.
7 </p>
8 <button id="button" onclick="popup()">Click Here</button>
9 <div id="console"></div>
10 <script>
11 function popup() {
12 window.open("about:blank", "window1");
13 window.open("about:blank", "window2");
14 if (window.testRunner) {
15 if (testRunner.windowCount() == windowCount + 1)
16 document.getElementById("console").innerText = "PASSED";
17 else
18 document.getElementById("console").innerText = "FAILED";
19 testRunner.notifyDone();
23 if (window.testRunner) {
24 testRunner.dumpAsText();
25 testRunner.setCanOpenWindows();
26 testRunner.setPopupBlockingEnabled(true);
27 testRunner.setCloseRemainingWindowsWhenComplete(true);
28 testRunner.waitUntilDone();
30 gc();
31 windowCount = testRunner.windowCount();
33 var button = document.getElementById("button");
35 if (window.eventSender) {
36 eventSender.mouseMoveTo(button.offsetLeft + button.offsetWidth / 2, button.offsetTop + button.offsetHeight / 2);
37 eventSender.mouseDown();
38 eventSender.mouseUp();
41 </script>
42 </body>
43 </html>