зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1670295 - [marionette] Port Marionette:singleTap to use JSWindowActors r=marionette-reviewers,whimboo,maja_zf
Depends on D93365 Differential Revision: https://phabricator.services.mozilla.com/D93325
This commit is contained in:
Родитель
891c58ed1a
Коммит
6e6f570643
|
@ -20,6 +20,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
evaluate: "chrome://marionette/content/evaluate.js",
|
||||
event: "chrome://marionette/content/event.js",
|
||||
interaction: "chrome://marionette/content/interaction.js",
|
||||
legacyaction: "chrome://marionette/content/legacyaction.js",
|
||||
Log: "chrome://marionette/content/log.js",
|
||||
sandbox: "chrome://marionette/content/evaluate.js",
|
||||
Sandboxes: "chrome://marionette/content/evaluate.js",
|
||||
|
@ -39,6 +40,17 @@ class MarionetteFrameChild extends JSWindowActorChild {
|
|||
return this.manager.innerWindowId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lazy getter to create a legacyaction Chain instance for touch events.
|
||||
*/
|
||||
get legacyactions() {
|
||||
if (!this._legacyactions) {
|
||||
this._legacyactions = new legacyaction.Chain();
|
||||
}
|
||||
|
||||
return this._legacyactions;
|
||||
}
|
||||
|
||||
actorCreated() {
|
||||
logger.trace(
|
||||
`[${this.browsingContext.id}] Child actor created for window id ${this.innerWindowId}`
|
||||
|
@ -147,6 +159,9 @@ class MarionetteFrameChild extends JSWindowActorChild {
|
|||
case "MarionetteFrameParent:sendKeysToElement":
|
||||
result = await this.sendKeysToElement(data);
|
||||
break;
|
||||
case "MarionetteFrameParent:singleTap":
|
||||
result = await this.singleTap(data);
|
||||
break;
|
||||
case "MarionetteFrameParent:switchToFrame":
|
||||
result = await this.switchToFrame(data);
|
||||
break;
|
||||
|
@ -476,6 +491,14 @@ class MarionetteFrameChild extends JSWindowActorChild {
|
|||
return interaction.sendKeysToElement(elem, text, opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a single tap.
|
||||
*/
|
||||
async singleTap(options = {}) {
|
||||
const { capabilities, elem, x, y } = options;
|
||||
return this.legacyactions.singleTap(elem, x, y, capabilities);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to the specified frame.
|
||||
*
|
||||
|
|
|
@ -219,6 +219,15 @@ class MarionetteFrameParent extends JSWindowActorParent {
|
|||
return this.sendQuery("MarionetteFrameParent:releaseActions");
|
||||
}
|
||||
|
||||
async singleTap(elem, x, y, capabilities) {
|
||||
return this.sendQuery("MarionetteFrameParent:singleTap", {
|
||||
capabilities,
|
||||
elem,
|
||||
x,
|
||||
y,
|
||||
});
|
||||
}
|
||||
|
||||
async switchToFrame(id) {
|
||||
const {
|
||||
browsingContextId,
|
||||
|
|
|
@ -1898,6 +1898,11 @@ GeckoDriver.prototype.singleTap = async function(cmd) {
|
|||
let { id, x, y } = cmd.parameters;
|
||||
let webEl = WebElement.fromUUID(id, this.context);
|
||||
|
||||
if (MarionettePrefs.useActors) {
|
||||
await this.getActor().singleTap(webEl, x, y, this.capabilities);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (this.context) {
|
||||
case Context.Chrome:
|
||||
throw new error.UnsupportedOperationError(
|
||||
|
|
Загрузка…
Ссылка в новой задаче