rename from testing/marionette/actions.js
rename to testing/marionette/action.js
--- a/testing/marionette/actions.js
+++ b/testing/marionette/action.js
@@ -7,26 +7,26 @@ const {classes: Cc, interfaces: Ci, util
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("chrome://marionette/content/event.js");
const CONTEXT_MENU_DELAY_PREF = "ui.click_hold_context_menus.delay";
const DEFAULT_CONTEXT_MENU_DELAY = 750; // ms
-this.EXPORTED_SYMBOLS = ["actions"];
+this.EXPORTED_SYMBOLS = ["action"];
const logger = Log.repository.getLogger("Marionette");
-this.actions = {};
+this.action = {};
/**
* Functionality for (single finger) action chains.
*/
-actions.Chain = function(checkForInterrupted) {
+action.Chain = function(checkForInterrupted) {
// for assigning unique ids to all touches
this.nextTouchId = 1000;
// keep track of active Touches
this.touchIds = {};
// last touch for each fingerId
this.lastCoordinates = null;
this.isTap = false;
this.scrolling = false;
@@ -42,17 +42,17 @@ actions.Chain = function(checkForInterru
} else {
this.checkForInterrupted = () => {};
}
// determines if we create touch events
this.inputSource = null;
};
-actions.Chain.prototype.dispatchActions = function(
+action.Chain.prototype.dispatchActions = function(
args,
touchId,
container,
elementManager,
callbacks,
touchProvider) {
// Some touch events code in the listener needs to do ipc, so we can't
// share this code across chrome/content.
@@ -100,17 +100,17 @@ actions.Chain.prototype.dispatchActions
* Number of clicks, button notes the mouse button.
* @param {number} elClientX
* X coordinate of the mouse relative to the viewport.
* @param {number} elClientY
* Y coordinate of the mouse relative to the viewport.
* @param {Object} modifiers
* An object of modifier keys present.
*/
-actions.Chain.prototype.emitMouseEvent = function(
+action.Chain.prototype.emitMouseEvent = function(
doc,
type,
elClientX,
elClientY,
button,
clickCount,
modifiers) {
if (!this.checkForInterrupted()) {
@@ -142,33 +142,33 @@ actions.Chain.prototype.emitMouseEvent =
0,
this.inputSource);
}
};
/**
* Reset any persisted values after a command completes.
*/
-actions.Chain.prototype.resetValues = function() {
+action.Chain.prototype.resetValues = function() {
this.onSuccess = null;
this.onError = null;
this.container = null;
this.elementManager = null;
this.touchProvider = null;
this.mouseEventsOnly = false;
};
/**
* Function to emit touch events for each finger. e.g.
* finger=[['press', id], ['wait', 5], ['release']] touchId represents
* the finger id, i keeps track of the current action of the chain
* keyModifiers is an object keeping track keyDown/keyUp pairs through
* an action chain.
*/
-actions.Chain.prototype.actions = function(chain, touchId, i, keyModifiers) {
+action.Chain.prototype.actions = function(chain, touchId, i, keyModifiers) {
if (i == chain.length) {
this.onSuccess(touchId || null);
this.resetValues();
return;
}
let pack = chain[i];
let command = pack[0];
@@ -318,17 +318,17 @@ actions.Chain.prototype.actions = functi
* The target to calculate coordinates of.
* @param {number} x
* X coordinate relative to target. If unspecified, the centre of
* the target is used.
* @param {number} y
* Y coordinate relative to target. If unspecified, the centre of
* the target is used.
*/
-actions.Chain.prototype.coordinates = function(target, x, y) {
+action.Chain.prototype.coordinates = function(target, x, y) {
let box = target.getBoundingClientRect();
if (x == null) {
x = box.width / 2;
}
if (y == null) {
y = box.height / 2;
}
let coords = {};
@@ -336,17 +336,17 @@ actions.Chain.prototype.coordinates = fu
coords.y = box.top + y;
return coords;
};
/**
* Given an element and a pair of coordinates, returns an array of the
* form [clientX, clientY, pageX, pageY, screenX, screenY].
*/
-actions.Chain.prototype.getCoordinateInfo = function(el, corx, cory) {
+action.Chain.prototype.getCoordinateInfo = function(el, corx, cory) {
let win = el.ownerDocument.defaultView;
return [
corx, // clientX
cory, // clientY
corx + win.pageXOffset, // pageX
cory + win.pageYOffset, // pageY
corx + win.mozInnerScreenX, // screenX
cory + win.mozInnerScreenY // screenY
@@ -356,17 +356,17 @@ actions.Chain.prototype.getCoordinateInf
/**
* @param {number} x
* X coordinate of the location to generate the event that is relative
* to the viewport.
* @param {number} y
* Y coordinate of the location to generate the event that is relative
* to the viewport.
*/
-actions.Chain.prototype.generateEvents = function(
+action.Chain.prototype.generateEvents = function(
type, x, y, touchId, target, keyModifiers) {
this.lastCoordinates = [x, y];
let doc = this.container.frame.document;
switch (type) {
case "tap":
if (this.mouseEventsOnly) {
this.mouseTap(
@@ -489,13 +489,13 @@ actions.Chain.prototype.generateEvents =
break;
default:
throw new WebDriverError("Unknown event type: " + type);
}
this.checkForInterrupted();
};
-actions.Chain.prototype.mouseTap = function(doc, x, y, button, count, mod) {
+action.Chain.prototype.mouseTap = function(doc, x, y, button, count, mod) {
this.emitMouseEvent(doc, "mousemove", x, y, button, count, mod);
this.emitMouseEvent(doc, "mousedown", x, y, button, count, mod);
this.emitMouseEvent(doc, "mouseup", x, y, button, count, mod);
};
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -18,17 +18,17 @@ Cu.import("resource://gre/modules/Task.j
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
var {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {});
this.DevToolsUtils = devtools.require("devtools/shared/DevToolsUtils");
XPCOMUtils.defineLazyServiceGetter(
this, "cookieManager", "@mozilla.org/cookiemanager;1", "nsICookieManager2");
-Cu.import("chrome://marionette/content/actions.js");
+Cu.import("chrome://marionette/content/action.js");
Cu.import("chrome://marionette/content/atom.js");
Cu.import("chrome://marionette/content/interaction.js");
Cu.import("chrome://marionette/content/element.js");
Cu.import("chrome://marionette/content/event.js");
Cu.import("chrome://marionette/content/frame-manager.js");
Cu.import("chrome://marionette/content/error.js");
Cu.import("chrome://marionette/content/modal.js");
Cu.import("chrome://marionette/content/proxy.js");
@@ -128,17 +128,17 @@ this.GeckoDriver = function(appName, dev
this.currentFrameElement = null;
this.testName = null;
this.mozBrowserClose = null;
this.sandboxes = {};
// frame ID of the current remote frame, used for mozbrowserclose events
this.oopFrameId = null;
this.observing = null;
this._browserIds = new WeakMap();
- this.actions = new actions.Chain();
+ this.actions = new action.Chain();
this.sessionCapabilities = {
// mandated capabilities
"browserName": Services.appinfo.name,
"browserVersion": Services.appinfo.version,
"platformName": Services.sysinfo.getProperty("name"),
"platformVersion": Services.sysinfo.getProperty("version"),
"specificationLevel": "1",