summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-23 01:47:58 +0000
committeryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-23 01:47:58 +0000
commitdce8e81538feb75e18e3927b792984a64520f945 (patch)
treec53d144869af0529049490977e4747cb62c9e44d
parente381d5125c64512a0a8febc40c7b8444320ecf1b (diff)
downloadchromium_src-dce8e81538feb75e18e3927b792984a64520f945.zip
chromium_src-dce8e81538feb75e18e3927b792984a64520f945.tar.gz
chromium_src-dce8e81538feb75e18e3927b792984a64520f945.tar.bz2
Merge 244738 "[Files.app] Simulate a real mouse click in fakeMou..."
> [Files.app] Simulate a real mouse click in fakeMouseClick in test > > Some controls (eg. gear button) watch 'mouseover' and/or 'mouseup' events to see an user clicking, instead of 'click' event. With this patch, fakeMouseClick fires 'mouseover', 'mouseup' and 'mousedown' events before 'click' event so this simulates a real mouse click. This patch is depended by http://crrev.com/128023002/. > > BUG=329166 > TEST=manually tested > > Review URL: https://codereview.chromium.org/134233004 TBR=yoshiki@chromium.org Review URL: https://codereview.chromium.org/143903020 git-svn-id: svn://svn.chromium.org/chrome/branches/1750/src@246479 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/file_manager/background/js/test_util.js24
1 files changed, 18 insertions, 6 deletions
diff --git a/chrome/browser/resources/file_manager/background/js/test_util.js b/chrome/browser/resources/file_manager/background/js/test_util.js
index cca9b35..3a3bd78 100644
--- a/chrome/browser/resources/file_manager/background/js/test_util.js
+++ b/chrome/browser/resources/file_manager/background/js/test_util.js
@@ -566,19 +566,31 @@ test.util.sync.fakeKeyDown = function(
};
/**
- * Sends a fake mouse click event (left button, single click) to the element
- * specified by |targetQuery|.
+ * Simulates a fake mouse click (left button, single click) on the element
+ * specified by |targetQuery|. This sends 'mouseover', 'mousedown', 'mouseup'
+ * and 'click' events in turns.
*
* @param {Window} contentWindow Window to be tested.
* @param {string} targetQuery Query to specify the element.
* @param {string=} opt_iframeQuery Optional iframe selector.
- * @return {boolean} True if the event is sent to the target, false otherwise.
+ * @return {boolean} True if the all events are sent to the target, false
+ * otherwise.
*/
test.util.sync.fakeMouseClick = function(
contentWindow, targetQuery, opt_iframeQuery) {
- var event = new MouseEvent('click', { bubbles: true, detail: 1 });
- return test.util.sync.sendEvent(
- contentWindow, targetQuery, event, opt_iframeQuery);
+ var mouseOverEvent = new MouseEvent('mouseover', {bubbles: true, detail: 1});
+ var resultMouseOver = test.util.sync.sendEvent(
+ contentWindow, targetQuery, mouseOverEvent, opt_iframeQuery);
+ var mouseDownEvent = new MouseEvent('mousedown', {bubbles: true, detail: 1});
+ var resultMouseDown = test.util.sync.sendEvent(
+ contentWindow, targetQuery, mouseDownEvent, opt_iframeQuery);
+ var mouseUpEvent = new MouseEvent('mouseup', {bubbles: true, detail: 1});
+ var resultMouseUp = test.util.sync.sendEvent(
+ contentWindow, targetQuery, mouseUpEvent, opt_iframeQuery);
+ var clickEvent = new MouseEvent('click', {bubbles: true, detail: 1});
+ var resultClick = test.util.sync.sendEvent(
+ contentWindow, targetQuery, clickEvent, opt_iframeQuery);
+ return resultMouseOver && resultMouseDown && resultMouseUp && resultClick;
};
/**