Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / gesture-tap-scrolled.html
blobf997c172a5bc3313eac5f978a70c840bade936c9
1 <!DOCTYPE HTML>
2 <script src="../../../../resources/js-test.js"></script>
3 <style>
4 html, body {
5 margin: 0;
6 width: 2000px;
7 height: 2000px;
9 </style>
10 <div id=console></div>
11 <script>
12 var event;
13 var scrollOffset = {
14 x: 12,
15 y: 42
17 var point = {
18 x: 50,
19 y: 50
22 var eventReceived = {};
24 function onEvent(e) {
25 debug("Received " + e.type + " in page");
26 event = e;
27 eventReceived[e.type] = true;
28 shouldBe("event.screenX", "point.x");
29 shouldBe("event.screenY", "point.y");
30 shouldBe("event.clientX", "point.x");
31 shouldBe("event.clientY", "point.y");
32 shouldBe("event.pageX", "point.x + scrollOffset.x");
33 shouldBe("event.pageY", "point.y + scrollOffset.y");
36 var eventTypes = ['mousemove', 'mousedown', 'mouseup', 'click'];
37 for (var i = 0; i < eventTypes.length; i++)
38 document.addEventListener(eventTypes[i],onEvent);
40 description("Verifies that a tap occuring in a scrolled page has the correct co-ordinates");
42 if (window.eventSender) {
43 jsTestIsAsync = true;
44 window.onload = function() {
45 window.scrollTo(scrollOffset.x, scrollOffset.y);
47 debug("Sending GestureTapDown to " + point.x + "," + point.y);
48 eventSender.gestureTapDown(point.x, point.y);
50 debug("Sending GestureShowPress");
51 eventSender.gestureShowPress(point.x, point.y);
53 debug("Sending GestureTap");
54 eventSender.gestureTap(point.x, point.y);
56 shouldBeTrue("eventReceived.mousemove");
57 shouldBeTrue("eventReceived.mousedown");
58 shouldBeTrue("eventReceived.mouseup");
59 shouldBeTrue("eventReceived.click");
60 setTimeout(finishJSTest, 100);
62 } else {
63 debug("This test requires eventSender");
65 </script>