author | Andreas Tolfsen <ato@mozilla.com> |
Wed, 02 Sep 2015 13:36:03 +0100 | |
changeset 274389 | ba8cd968866afa4578f1ec2d52d31d8e0753d81a |
parent 274388 | a2e18ea18461d994081513a1234e71f12c2ab97f |
child 274390 | 238dd6c3aef79b5aa530312c6b6762099e7d7eed |
push id | 29730 |
push user | cbook@mozilla.com |
push date | Fri, 27 Nov 2015 10:08:56 +0000 |
treeherder | mozilla-central@47b49b0d3236 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1201050 |
milestone | 45.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
testing/marionette/driver.js | file | annotate | diff | comparison | revisions | |
testing/marionette/listener.js | file | annotate | diff | comparison | revisions |
--- a/testing/marionette/driver.js +++ b/testing/marionette/driver.js @@ -1857,17 +1857,17 @@ GeckoDriver.prototype.actionChain = func let win = this.getCurrentWindow(); let elm = this.curBrowser.elementManager; this.actions.dispatchActions(chain, nextId, { frame: win }, elm, cbs); break; case Context.CONTENT: this.addFrameCloseListener("action chain"); - resp.body.value = yield this.listener.actionChain({chain: chain, nextId: nextId}); + resp.body.value = yield this.listener.actionChain(chain, nextId); break; } }; /** * A multi-action chain. * * @param {Object} value
--- a/testing/marionette/listener.js +++ b/testing/marionette/listener.js @@ -212,28 +212,29 @@ var findElementsContentFn = dispatch(fin var isElementSelectedFn = dispatch(isElementSelected); var clearElementFn = dispatch(clearElement); var isElementDisplayedFn = dispatch(isElementDisplayed); var getElementValueOfCssPropertyFn = dispatch(getElementValueOfCssProperty); var switchToShadowRootFn = dispatch(switchToShadowRoot); var getCookiesFn = dispatch(getCookies); var singleTapFn = dispatch(singleTap); var takeScreenshotFn = dispatch(takeScreenshot); +var actionChainFn = dispatch(actionChain); /** * Start all message listeners */ function startListeners() { addMessageListenerId("Marionette:receiveFiles", receiveFiles); addMessageListenerId("Marionette:newSession", newSession); addMessageListenerId("Marionette:executeScript", executeScript); addMessageListenerId("Marionette:executeAsyncScript", executeAsyncScript); addMessageListenerId("Marionette:executeJSScript", executeJSScript); addMessageListenerId("Marionette:singleTap", singleTapFn); - addMessageListenerId("Marionette:actionChain", actionChain); + addMessageListenerId("Marionette:actionChain", actionChainFn); addMessageListenerId("Marionette:multiAction", multiAction); addMessageListenerId("Marionette:get", get); addMessageListenerId("Marionette:pollForReadyState", pollForReadyState); addMessageListenerId("Marionette:cancelRequest", cancelRequest); addMessageListenerId("Marionette:getCurrentUrl", getCurrentUrlFn); addMessageListenerId("Marionette:getTitle", getTitleFn); addMessageListenerId("Marionette:getPageSource", getPageSourceFn); addMessageListenerId("Marionette:goBack", goBackFn); @@ -328,17 +329,17 @@ function restart(msg) { */ function deleteSession(msg) { removeMessageListenerId("Marionette:receiveFiles", receiveFiles); removeMessageListenerId("Marionette:newSession", newSession); removeMessageListenerId("Marionette:executeScript", executeScript); removeMessageListenerId("Marionette:executeAsyncScript", executeAsyncScript); removeMessageListenerId("Marionette:executeJSScript", executeJSScript); removeMessageListenerId("Marionette:singleTap", singleTapFn); - removeMessageListenerId("Marionette:actionChain", actionChain); + removeMessageListenerId("Marionette:actionChain", actionChainFn); removeMessageListenerId("Marionette:multiAction", multiAction); removeMessageListenerId("Marionette:get", get); removeMessageListenerId("Marionette:pollForReadyState", pollForReadyState); removeMessageListenerId("Marionette:cancelRequest", cancelRequest); removeMessageListenerId("Marionette:getTitle", getTitleFn); removeMessageListenerId("Marionette:getPageSource", getPageSourceFn); removeMessageListenerId("Marionette:getCurrentUrl", getCurrentUrlFn); removeMessageListenerId("Marionette:goBack", goBackFn); @@ -1055,42 +1056,32 @@ function createATouch(el, corx, cory, to let win = doc.defaultView; let [clientX, clientY, pageX, pageY, screenX, screenY] = actions.getCoordinateInfo(el, corx, cory); let atouch = doc.createTouch(win, el, touchId, pageX, pageY, screenX, screenY, clientX, clientY); return atouch; } /** - * Function to start action chain on one finger + * Start action chain on one finger. */ -function actionChain(msg) { - let command_id = msg.json.command_id; - let args = msg.json.chain; - let touchId = msg.json.nextId; - - let callbacks = {}; - callbacks.onSuccess = value => sendResponse(value, command_id); - callbacks.onError = err => sendError(err, command_id); - +function actionChain(chain, touchId) { let touchProvider = {}; touchProvider.createATouch = createATouch; touchProvider.emitTouchEvent = emitTouchEvent; - try { + return new Promise((resolve, reject) => { actions.dispatchActions( - args, + chain, touchId, curContainer, elementManager, - callbacks, + {onSuccess: resolve, onError: reject}, touchProvider); - } catch (e) { - sendError(e, command_id); - } + }); } /** * Function to emit touch events which allow multi touch on the screen * @param type represents the type of event, touch represents the current touch,touches are all pending touches */ function emitMultiEvents(type, touch, touches) { let target = touch.target;