| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../../resources/js-test-pre.js"></script> |
| <!-- |
| Touch tests that involve the ontouchstart, ontouchmove, ontouchend or ontouchcancel callbacks |
| should be written in an asynchronous fashion so they can be run on mobile platforms like Android. |
| You will need to invoke isSuccessfullyParsed() in your test script when the test completes. |
| --> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| <script> |
| description("Tests that the cancel touch event is sent correctly."); |
| |
| var touchX = 25; |
| var touchY = 25; |
| |
| var cancelEvent = null; |
| |
| function touchcancelHandler() { |
| shouldBeEqualToString("event.type", "touchcancel"); |
| cancelEvent = event.changedTouches[0]; |
| shouldBeNonNull("cancelEvent"); |
| shouldBe("cancelEvent.pageX", touchX.toString()); |
| shouldBe("cancelEvent.pageY", touchY.toString()); |
| if (window.testRunner) { |
| testRunner.notifyDone(); |
| isSuccessfullyParsed(); |
| } |
| } |
| |
| if (window.testRunner) |
| window.testRunner.waitUntilDone(); |
| |
| window.onload = function() { |
| if (window.eventSender) { |
| document.addEventListener("touchcancel", touchcancelHandler, false); |
| eventSender.addTouchPoint(touchX, touchY); |
| eventSender.touchStart(); |
| eventSender.cancelTouchPoint(0); |
| eventSender.touchCancel(); |
| } else |
| debug("This test requires DumpRenderTree."); |
| } |
| </script> |
| </body> |
| </html> |