From ea850c1150ad9ee71e5bccaafc909eaec4308fc3 Mon Sep 17 00:00:00 2001 From: Malini Das Date: Thu, 10 Jan 2013 17:40:17 -0800 Subject: [PATCH] Bug 829377 - tap() in synthetic_gestures should send touch/mouse/click events, r=jgriffin --- .../marionette/touch/synthetic_gestures.js | 16 +++++++++++----- testing/marionette/client/setup.py | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/testing/marionette/client/marionette/touch/synthetic_gestures.js b/testing/marionette/client/marionette/touch/synthetic_gestures.js index 6bd293b112ea..aeb054126116 100644 --- a/testing/marionette/client/marionette/touch/synthetic_gestures.js +++ b/testing/marionette/client/marionette/touch/synthetic_gestures.js @@ -298,7 +298,9 @@ var SyntheticGestures = (function() { var c = coordinates(target, x, y); - touch(target, t || 50, [c.x0, c.x0], [c.y0, c.y0], then); + touch(target, t || 50, [c.x0, c.x0], [c.y0, c.y0], function() { + mousetap(target, then, x, y, t, true); + }); } // Dispatch a dbltap gesture. The arguments are like those to tap() @@ -431,7 +433,7 @@ var SyntheticGestures = (function() { // This is a low-level function that the higher-level mouse gesture // utilities are built on. Most testing code will not need to call it. // - function drag(doc, duration, xt, yt, then, detail, button) { + function drag(doc, duration, xt, yt, then, detail, button, sendClick) { var win = doc.defaultView; detail = detail || 1; button = button || 0; @@ -506,8 +508,12 @@ var SyntheticGestures = (function() { // Otherwise, schedule the next move event if (last) { mouseEvent('mouseup', lastX, lastY); - if (then) + if (sendClick) { + mouseEvent('click', clientX, clientY); + } + if (then) { setTimeout(then, 0); + } } else { setTimeout(nextEvent, EVENT_INTERVAL); @@ -517,14 +523,14 @@ var SyntheticGestures = (function() { // Send a mousedown/mouseup pair // XXX: will the browser automatically follow this with a click event? - function mousetap(target, then, x, y, t) { + function mousetap(target, then, x, y, t, sendClick) { if (x == null) x = '50%'; if (y == null) y = '50%'; var c = coordinates(target, x, y); - drag(target.ownerDocument, t || 50, [c.x0, c.x0], [c.y0, c.y0], then); + drag(target.ownerDocument, t || 50, [c.x0, c.x0], [c.y0, c.y0], then, null, null, sendClick); } // Dispatch a dbltap gesture. The arguments are like those to tap() diff --git a/testing/marionette/client/setup.py b/testing/marionette/client/setup.py index 1154280da19b..f6366b862769 100644 --- a/testing/marionette/client/setup.py +++ b/testing/marionette/client/setup.py @@ -1,7 +1,7 @@ import os from setuptools import setup, find_packages -version = '0.5.14' +version = '0.5.15' # get documentation from the README try: