1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../../resources/js-test.js"></script>
5 <style type=
"text/css">
17 <body style=
"width: 2000px; height: 2000px" onload=
"runTest();">
18 <div id=
"touchtarget">
20 <p id=
"description"></p>
21 <div id=
"console"></div>
24 var clickEventsReceived
= 0;
25 var expectedMouseEvents
= 4;
26 var mouseEventsReceived
= 0;
27 var eventTypes
= [ 'mousemove', 'mousedown', 'mouseup', 'click' ];
29 function gestureEventCallback(event
)
31 if (window
.eventSender
) {
32 shouldBeEqualToString('event.type', eventTypes
[mouseEventsReceived
]);
33 shouldBe('event.clientX', '20');
34 shouldBe('event.clientY', '24');
35 shouldBe("event.shiftKey", "false");
36 shouldBe("event.altKey", "false");
37 shouldBe("event.ctrlKey", "false");
38 shouldBe("event.metaKey", "false");
39 mouseEventsReceived
++;
47 // Because we may not have a gesture recognizer, we send a key press
48 // event to end the test without temporal flakiness.
49 function quitKeyToEndTest(event
) {
53 // Log that we still got the touch events.
54 function touchEventCallback(event
) {
55 touchEventsReceived
++;
56 debug('have received: ' + touchEventsReceived
+ ' touch events');
62 if (mouseEventsReceived
< expectedMouseEvents
) {
63 debug('Gesture manager not implemented on this platform.');
66 isSuccessfullyParsed();
67 testRunner
.notifyDone();
71 if (window
.internals
) {
72 internals
.setPageScaleFactorLimits(0.5, 0.5);
73 internals
.setPageScaleFactor(0.5);
76 var div
= document
.getElementById('touchtarget');
77 div
.addEventListener("mousedown", gestureEventCallback
, false);
78 div
.addEventListener("click", gestureEventCallback
, false);
79 div
.addEventListener("mouseup", gestureEventCallback
, false);
80 div
.addEventListener("mousemove", gestureEventCallback
, false);
81 document
.addEventListener("keydown", quitKeyToEndTest
, false);
83 if (window
.testRunner
)
84 testRunner
.waitUntilDone();
86 if (window
.eventSender
&& window
.internals
) {
87 description("This tests basic single touch gesture generation.");
88 if (eventSender
.clearTouchPoints
) {
89 eventSender
.gestureTap(10, 12);
90 eventSender
.leapForward(10);
91 eventSender
.keyDown(' ');
96 debug("This test requires DumpRenderTree. Tap on the blue rect to log.")