Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / gesture-click.html
blob73fd260ba67b8abf2ae2058df545984ed334f6e8
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../../resources/js-test.js"></script>
5 </head>
6 <body onload="runTest();">
7 <div id="gesture">
9 <p id="description"></p>
10 <div id="console"></div>
12 <script>
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++;
29 } else {
30 debug(event.type);
31 debug(event.clientX);
32 debug(event.clientY);
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) {
39 endTest();
42 function endTest()
44 if (mouseEventsReceived < expectedEvents.length) {
45 debug('Gesture manager not implemented on this platform.');
47 // Bail.
48 isSuccessfullyParsed();
49 testRunner.notifyDone();
52 function runTest() {
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(' ');
72 } else {
73 debug("This test requires DumpRenderTree. Tap on the blue rect to log.")
76 </script>
77 </body>
78 </html>