From b62463c664d99f05a9e22c633479d40e28aaef72 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Tue, 8 Sep 2015 17:12:18 +0100 Subject: [PATCH] Bug 1202707: Remove emulator commands from simpletest harness We attach the emulator commands outside of the simpletest harness. Removing this makes testing/marionette/simpletest.js less dependent on Marionette. r=dburns --HG-- extra : commitid : 8jVQBdufXQg extra : rebase_source : 5ea9660825fd76504d0cc7fdbc1bebba947836f5 --- testing/marionette/driver.js | 2 -- testing/marionette/listener.js | 10 ++++------ testing/marionette/simpletest.js | 18 ++---------------- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/testing/marionette/driver.js b/testing/marionette/driver.js index 274ff62804cc..783d684d0414 100644 --- a/testing/marionette/driver.js +++ b/testing/marionette/driver.js @@ -908,7 +908,6 @@ GeckoDriver.prototype.execute = function(cmd, resp, directInject) { !(sandboxName in this.sandboxes) || (this.sandboxes[sandboxName].proto != win)) { let marionette = new Marionette( - this, win, "chrome", this.marionetteLog, @@ -1112,7 +1111,6 @@ GeckoDriver.prototype.executeWithCallback = function(cmd, resp, directInject) { if (newSandbox || !(sandboxName in this.sandboxes)) { let marionette = new Marionette( - this, win, "chrome", this.marionetteLog, diff --git a/testing/marionette/listener.js b/testing/marionette/listener.js index 6d7d32c6c575..61b1530764b3 100644 --- a/testing/marionette/listener.js +++ b/testing/marionette/listener.js @@ -476,20 +476,16 @@ function checkForInterrupted() { */ function createExecuteContentSandbox(win, timeout) { let mn = new Marionette( - this, win, "content", marionetteLogObj, timeout, heartbeatCallback, marionetteTestName); - mn.runEmulatorCmd = (cmd, cb) => this.runEmulatorCmd(cmd, cb); - mn.runEmulatorShell = (args, cb) => this.runEmulatorShell(args, cb); let principal = win; - if (sandboxName == 'system') { - principal = Cc["@mozilla.org/systemprincipal;1"]. - createInstance(Ci.nsIPrincipal); + if (sandboxName == "system") { + principal = Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal); } let sandbox = new Cu.Sandbox(principal, {sandboxPrototype: win}); sandbox.global = sandbox; @@ -507,6 +503,8 @@ function createExecuteContentSandbox(win, timeout) { sandbox[fn] = mn[fn]; } }); + sandbox.runEmulatorCmd = (cmd, cb) => this.runEmulatorCmd(cmd, cb); + sandbox.runEmulatorShell = (args, cb) => this.runEmulatorShell(args, cb); sandbox.asyncComplete = (obj, id) => { if (id == asyncTestCommandId) { diff --git a/testing/marionette/simpletest.js b/testing/marionette/simpletest.js index 128d902e000a..1cd42df46ff8 100644 --- a/testing/marionette/simpletest.js +++ b/testing/marionette/simpletest.js @@ -11,9 +11,8 @@ this.EXPORTED_SYMBOLS = ["Marionette"]; /* * The Marionette object, passed to the script context. */ -this.Marionette = function(scope, window, context, logObj, timeout, - heartbeatCallback, testName) { - this.scope = scope; +this.Marionette = function(window, context, logObj, timeout, + heartbeatCallback, testName) { this.window = window; this.tests = []; this.logObj = logObj; @@ -37,8 +36,6 @@ Marionette.prototype = { "getLogs", "generate_results", "waitFor", - "runEmulatorCmd", - "runEmulatorShell", "TEST_PASS", "TEST_KNOWN_FAIL", "TEST_UNEXPECTED_FAIL", @@ -46,7 +43,6 @@ Marionette.prototype = { ], addTest: function Marionette__addTest(condition, name, passString, failString, diag, state) { - let test = {'result': !!condition, 'name': name, 'diag': diag, 'state': state}; this.logResult(test, typeof(passString) == "undefined" ? this.TEST_PASS : passString, @@ -203,14 +199,4 @@ Marionette.prototype = { } this.window.setTimeout(this.waitFor.bind(this), 100, callback, test, deadline); }, - - runEmulatorCmd: function runEmulatorCmd(cmd, callback) { - this.heartbeatCallback(); - this.scope.runEmulatorCmd(cmd, callback); - }, - - runEmulatorShell: function runEmulatorShell(args, callback) { - this.heartbeatCallback(); - this.scope.runEmulatorShell(args, callback); - }, };