OLD | NEW |
(Empty) | |
| 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) |
| 12 { |
| 13 document.querySelector("#console").innerHTML += msg + "<br>"; |
| 14 } |
| 15 |
| 16 function popup() |
| 17 { |
| 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"); |
| 24 } |
| 25 } |
| 26 |
| 27 function touchStart(e) |
| 28 { |
| 29 log("touchstart event"); |
| 30 e.preventDefault(); |
| 31 popup(); |
| 32 } |
| 33 |
| 34 function touchMove(e) |
| 35 { |
| 36 log("touchmove event"); |
| 37 e.preventDefault(); |
| 38 popup(); |
| 39 } |
| 40 |
| 41 |
| 42 function touchEnd(e) |
| 43 { |
| 44 log("touchend event"); |
| 45 e.preventDefault(); |
| 46 popup(); |
| 47 if (window.testRunner) |
| 48 testRunner.notifyDone(); |
| 49 } |
| 50 |
| 51 document.addEventListener("touchstart", touchStart); |
| 52 document.addEventListener("touchmove", touchMove); |
| 53 document.addEventListener("touchend", touchEnd); |
| 54 |
| 55 if (window.testRunner) { |
| 56 testRunner.dumpAsText(); |
| 57 testRunner.setCanOpenWindows(); |
| 58 testRunner.setPopupBlockingEnabled(true); |
| 59 testRunner.setCloseRemainingWindowsWhenComplete(true); |
| 60 testRunner.waitUntilDone(); |
| 61 |
| 62 gc(); |
| 63 windowCount = testRunner.windowCount(); |
| 64 |
| 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(); |
| 80 } |
| 81 } |
| 82 </script> |
| 83 </body> |
| 84 </html> |
OLD | NEW |