Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / popup-allowed-from-gesture-only-once-two-events.html
blob4d442f808d8b5006f0ffbca033ef2532b42db970
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, even if the the user action triggers multiple events.
7 The test passes if only one popup is created.
8 </p>
9 <button id="button" onmousedown="popup1()" onmouseup="popup2()">Click Here</button>
10 <div id="console"></div>
11 <script>
12 function popup1() {
13 window.open("about:blank", "window1");
16 function popup2() {
17 window.open("about:blank", "window2");
18 if (window.testRunner) {
19 if (testRunner.windowCount() == windowCount + 1)
20 document.getElementById("console").innerText = "PASSED";
21 else
22 document.getElementById("console").innerText = "FAILED";
23 testRunner.notifyDone();
27 if (window.testRunner) {
28 testRunner.dumpAsText();
29 testRunner.setCanOpenWindows();
30 testRunner.setPopupBlockingEnabled(true);
31 testRunner.setCloseRemainingWindowsWhenComplete(true);
32 testRunner.waitUntilDone();
33 windowCount = testRunner.windowCount();
35 var button = document.getElementById("button");
37 if (window.eventSender) {
38 eventSender.mouseMoveTo(button.offsetLeft + button.offsetWidth / 2, button.offsetTop + button.offsetHeight / 2);
39 eventSender.mouseDown();
40 eventSender.mouseUp();
43 </script>
44 </body>
45 </html>