Chromium Code Reviews| Index: LayoutTests/fast/events/popup-allowed-from-touch-only-once.html |
| diff --git a/LayoutTests/fast/events/popup-allowed-from-touch-only-once.html b/LayoutTests/fast/events/popup-allowed-from-touch-only-once.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..97078480e4cff3d0948a1c5cc2264ed7110cb61e |
| --- /dev/null |
| +++ b/LayoutTests/fast/events/popup-allowed-from-touch-only-once.html |
| @@ -0,0 +1,83 @@ |
| +<!DOCTYPE html> |
| +<html> |
| + <body> |
| + <p> |
| + Test that only a single popup is allowed in response to a single |
| + touch sequence. The test passes if only one popup is created when |
| + you touch and move around on this page. |
| + </p> |
| + <div id="console"></div> |
| + <script> |
| + function log(msg) |
| + { |
| + document.querySelector("#console").innerHTML += msg + "<br>"; |
| + } |
| + |
| + function popup() |
| + { |
| + window.open("about:blank"); |
| + if (window.testRunner) { |
| + if (testRunner.windowCount() > windowCount + 1) |
| + log("FAIL: too many popups"); |
| + else if (testRunner.windowCount() == windowCount) |
| + log("FAIL: could not open popup at all"); |
| + } |
| + } |
| + |
| + function touchStart(e) |
| + { |
| + log("touchstart event"); |
| + e.preventDefault(); |
| + popup(); |
| + } |
| + |
| + function touchMove(e) |
| + { |
| + log("touchmove event"); |
| + e.preventDefault(); |
| + popup(); |
| + } |
| + |
| + |
| + function touchEnd(e) |
| + { |
| + log("touchend event"); |
| + e.preventDefault(); |
| + popup(); |
| + if (window.testRunner) |
| + testRunner.notifyDone(); |
| + } |
| + |
| + document.addEventListener("touchstart", touchStart); |
| + document.addEventListener("touchmove", touchMove); |
| + document.addEventListener("touchend", touchEnd); |
| + |
| + if (window.testRunner) { |
| + testRunner.dumpAsText(); |
| + testRunner.setCanOpenWindows(); |
| + testRunner.setPopupBlockingEnabled(true); |
| + testRunner.setCloseRemainingWindowsWhenComplete(true); |
| + testRunner.waitUntilDone(); |
| + |
| + gc(); |
| + windowCount = testRunner.windowCount(); |
| + |
| + if (window.eventSender) { |
| + eventSender.clearTouchPoints(); |
| + eventSender.addTouchPoint(50, 50); |
| + eventSender.addTouchPoint(75, 50); |
|
Rick Byers
2014/06/12 21:14:23
nit: please add one more touchStart above here - t
jochen (gone - plz use gerrit)
2014/06/12 21:17:06
Done.
|
| + eventSender.touchStart(); |
| + eventSender.updateTouchPoint(0, 100, 100); |
| + eventSender.updateTouchPoint(1, 125, 100); |
| + eventSender.touchMove(); |
| + eventSender.updateTouchPoint(0, 100, 50); |
| + eventSender.updateTouchPoint(1, 200, 50); |
| + eventSender.touchMove(); |
| + eventSender.releaseTouchPoint(0); |
| + eventSender.releaseTouchPoint(1); |
| + eventSender.touchEnd(); |
| + } |
| + } |
| + </script> |
| + </body> |
| + </html> |