1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../../../resources/js-test.js"></script>
6 <body onload=
"runTest();">
9 <p id=
"description"></p>
10 <div id=
"console"></div>
13 var mouseEventsReceived
= 0;
14 var expectedEvents
= [
15 { type
: 'mousemove', detail
: 0 },
16 { type
: 'mousedown', detail
: 1 },
17 { type
: 'mouseup', detail
: 1 },
18 { type
: 'click', detail
: 1 },
21 function gestureEventCallback(event
)
23 if (window
.eventSender
) {
24 shouldBeEqualToString('event.type', expectedEvents
[mouseEventsReceived
].type
);
25 shouldBe('event.clientX', '10');
26 shouldBe('event.clientY', '12');
27 shouldEvaluateTo('event.detail', expectedEvents
[mouseEventsReceived
].detail
);
28 mouseEventsReceived
++;
36 // Because we may not have a gesture recognizer, we send a key press
37 // event to end the test without temporal flakiness.
38 function quitKeyToEndTest(event
) {
44 if (mouseEventsReceived
< expectedEvents
.length
) {
45 debug('Gesture manager not implemented on this platform.');
48 isSuccessfullyParsed();
49 testRunner
.notifyDone();
53 var div
= document
.getElementById('gesture');
54 div
.addEventListener("mousedown", gestureEventCallback
, false);
55 div
.addEventListener("click", gestureEventCallback
, false);
56 div
.addEventListener("dblclick", gestureEventCallback
, false);
57 div
.addEventListener("mouseup", gestureEventCallback
, false);
58 div
.addEventListener("mousemove", gestureEventCallback
, false);
59 document
.addEventListener("keydown", quitKeyToEndTest
, false);
61 if (window
.testRunner
) {
62 testRunner
.dumpAsText();
63 testRunner
.waitUntilDone();
66 if (window
.eventSender
) {
67 description("This tests basic gesture callbacks.");
68 // A 'tap' gesture event should generate a sequence of mouse events.
69 eventSender
.gestureTap(10, 12);
70 eventSender
.leapForward(10);
71 eventSender
.keyDown(' ');
73 debug("This test requires DumpRenderTree. Tap on the blue rect to log.")