Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / popup-allowed-from-touch-only-once.html
blobfd071c553b415587550d9c7aaf4b1b3727da3b6a
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <p>
5 Test that only a single popup is allowed in response to a single
6 touch sequence. The test passes if only one popup is created when
7 you touch and move around on this page.
8 </p>
9 <div id="console"></div>
10 <script>
11 function log(msg)
13 document.querySelector("#console").innerHTML += msg + "<br>";
16 function popup()
18 window.open("about:blank");
19 if (window.testRunner) {
20 if (testRunner.windowCount() > windowCount + 1)
21 log("FAIL: too many popups");
22 else if (testRunner.windowCount() == windowCount)
23 log("FAIL: could not open popup at all");
27 function touchStart(e)
29 log("touchstart event");
30 e.preventDefault();
31 popup();
34 function touchMove(e)
36 log("touchmove event");
37 e.preventDefault();
38 popup();
42 function touchEnd(e)
44 log("touchend event");
45 e.preventDefault();
46 popup();
47 if (window.testRunner)
48 testRunner.notifyDone();
51 document.addEventListener("touchstart", touchStart);
52 document.addEventListener("touchmove", touchMove);
53 document.addEventListener("touchend", touchEnd);
55 if (window.testRunner) {
56 testRunner.dumpAsText();
57 testRunner.setCanOpenWindows();
58 testRunner.setPopupBlockingEnabled(true);
59 testRunner.setCloseRemainingWindowsWhenComplete(true);
60 testRunner.waitUntilDone();
62 gc();
63 windowCount = testRunner.windowCount();
65 if (window.eventSender) {
66 eventSender.clearTouchPoints();
67 eventSender.addTouchPoint(50, 50);
68 eventSender.touchStart();
69 eventSender.addTouchPoint(75, 50);
70 eventSender.touchStart();
71 eventSender.updateTouchPoint(0, 100, 100);
72 eventSender.updateTouchPoint(1, 125, 100);
73 eventSender.touchMove();
74 eventSender.updateTouchPoint(0, 100, 50);
75 eventSender.updateTouchPoint(1, 200, 50);
76 eventSender.touchMove();
77 eventSender.releaseTouchPoint(0);
78 eventSender.releaseTouchPoint(1);
79 eventSender.touchEnd();
82 </script>
83 </body>
84 </html>