summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/events/touch/script-tests/send-oncancel-event.js
blob: af5275d0cd21df409c92e24b89a329cbd2b92a28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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.layoutTestController) {
        layoutTestController.notifyDone();
        isSuccessfullyParsed(); 
    }
}
    
if (window.layoutTestController)
    window.layoutTestController.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.");
}

var successfullyParsed = true;