90b80d3ad44684aabc31b818a9fbeb504a062937
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / events / touch / gesture / gesture-tap-frame-scrolled.html
1 <!DOCTYPE HTML>
2 <script src="../../../../resources/js-test.js"></script>
3 <style>
4 html, body {
5  margin: 0;
6 }
7 body {
8   height: 1000px;
9 }
10 #target {
11   width: 50px;
12   height: 50px;
13 }
14 </style>
15 <iframe frameborder=0 id="target" src="resources/event-delegator.html"></iframe>
16 <div id=console></div>
17 <script>
18 var event;
19 window.scrollTo(0, 3);
20 var rect = target.getBoundingClientRect();
21 var point = {
22     x: rect.left + rect.width / 2,
23     y: rect.top + rect.height / 2 - 3
24 };
25
26 var eventReceived = {};
27
28 function onEventInFrame(e) {
29     debug("Received " + e.type + " in child frame");
30     event = e;
31     eventReceived[e.type] = true;
32     shouldBe("event.screenX", "point.x");
33     shouldBe("event.screenY", "point.y");
34     shouldBe("event.clientX", "50 / 2");
35     shouldBe("event.clientY", "50 / 2 + 7");
36 }
37
38 description("Verifies that a tap occuring in a scrolled iframe has the correct co-ordinates");
39
40 if (window.eventSender) {
41     jsTestIsAsync = true;
42     target.onload = function() {
43         target.contentWindow.scrollTo(0, 7);
44
45         debug("Sending GestureTapDown to " + point.x + "," + point.y);
46         eventSender.gestureTapDown(point.x, point.y);
47
48         debug("Sending GestureShowPress");
49         eventSender.gestureShowPress(point.x, point.y);
50
51         debug("Sending GestureTap");
52         eventSender.gestureTap(point.x, point.y);
53
54         shouldBeTrue("eventReceived.mousemove");
55         shouldBeTrue("eventReceived.mousedown");
56         shouldBeTrue("eventReceived.mouseup");
57         shouldBeTrue("eventReceived.click");
58         setTimeout(finishJSTest, 100);
59     }
60 } else {
61     debug("This test requires eventSender");
62 }
63 </script>