Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: LayoutTests/fast/events/touch/gesture/gesture-tap-scrolled.html

Issue 641063003: Pass correct client coordinates for mouse events synthesized from a GestureTap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update test output Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <script src="../../../../resources/js-test.js"></script> 2 <script src="../../../../resources/js-test.js"></script>
3 <style> 3 <style>
4 html, body { 4 html, body {
5 margin: 0; 5 margin: 0;
6 } 6 }
7 body { 7 body {
8 height: 1000px; 8 height: 1000px;
9 } 9 }
10 #target {
11 width: 50px;
12 height: 50px;
13 }
14 </style> 10 </style>
15 <iframe frameborder=0 id="target" src="resources/event-delegator.html"></iframe>
16 <div id=console></div> 11 <div id=console></div>
17 <script> 12 <script>
18 var event; 13 var event;
19 window.scrollTo(0, 3); 14 var scrollOffset = 42;
20 var rect = target.getBoundingClientRect(); 15 window.scrollTo(0, scrollOffset);
21 var point = { 16 var point = {
22 x: rect.left + rect.width / 2, 17 x: 50,
23 y: rect.top + rect.height / 2 - 3 18 y: 50
24 }; 19 };
25 20
26 var eventReceived = {}; 21 var eventReceived = {};
27 22
28 function onEventInFrame(e) { 23 function onEventInFrame(e) {
Rick Byers 2014/10/10 00:39:35 nit: just call this onEvent (onEventInFrame is a s
Zeeshan Qureshi 2014/10/10 00:47:23 oops, missed updating this.
29 debug("Received " + e.type + " in child frame"); 24 debug("Received " + e.type + " in page");
30 event = e; 25 event = e;
31 eventReceived[e.type] = true; 26 eventReceived[e.type] = true;
32 shouldBe("event.screenX", "point.x"); 27 shouldBe("event.screenX", "point.x");
33 shouldBe("event.screenY", "point.y"); 28 shouldBe("event.screenY", "point.y");
34 shouldBe("event.clientX", "50 / 2"); 29 shouldBe("event.clientX", "point.x");
35 shouldBe("event.clientY", "50 / 2 + 7"); 30 shouldBe("event.clientY", "point.y");
36 } 31 }
37 32
38 description("Verifies that a tap occuring in a scrolled iframe has the correct c o-ordinates"); 33 var eventTypes = ['mousemove', 'mousedown', 'mouseup', 'click'];
34 for (var i = 0; i < eventTypes.length; i++)
35 document.addEventListener(eventTypes[i],onEventInFrame);
36
37 description("Verifies that a tap occuring in a scrolled page has the correct co- ordinates");
39 38
40 if (window.eventSender) { 39 if (window.eventSender) {
41 jsTestIsAsync = true; 40 jsTestIsAsync = true;
42 target.onload = function() { 41 window.onload = function() {
43 target.contentWindow.scrollTo(0, 7);
44
45 debug("Sending GestureTapDown to " + point.x + "," + point.y); 42 debug("Sending GestureTapDown to " + point.x + "," + point.y);
46 eventSender.gestureTapDown(point.x, point.y); 43 eventSender.gestureTapDown(point.x, point.y);
47 44
48 debug("Sending GestureShowPress"); 45 debug("Sending GestureShowPress");
49 eventSender.gestureShowPress(point.x, point.y); 46 eventSender.gestureShowPress(point.x, point.y);
50 47
51 debug("Sending GestureTap"); 48 debug("Sending GestureTap");
52 eventSender.gestureTap(point.x, point.y); 49 eventSender.gestureTap(point.x, point.y);
53 50
54 shouldBeTrue("eventReceived.mousemove"); 51 shouldBeTrue("eventReceived.mousemove");
55 shouldBeTrue("eventReceived.mousedown"); 52 shouldBeTrue("eventReceived.mousedown");
56 shouldBeTrue("eventReceived.mouseup"); 53 shouldBeTrue("eventReceived.mouseup");
57 shouldBeTrue("eventReceived.click"); 54 shouldBeTrue("eventReceived.click");
58 setTimeout(finishJSTest, 100); 55 setTimeout(finishJSTest, 100);
59 } 56 }
60 } else { 57 } else {
61 debug("This test requires eventSender"); 58 debug("This test requires eventSender");
62 } 59 }
63 </script> 60 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698