From f2225720a9cab9584c4957ee98b733de3d3aaf98 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Wed, 7 Jun 2017 14:17:41 +0100 Subject: [PATCH] Bug 1370863 - Remove log and getLogs commands from Marionette; r=automatedtester MozReview-Commit-ID: HFZfJGwSqyT --HG-- extra : rebase_source : eb04f0a3fa55d17eb5fef9bff3170ba5ce147eff --- testing/marionette/driver.js | 35 --------- .../marionette_test/testcases.py | 8 +- testing/marionette/jar.mn | 1 - testing/marionette/listener.js | 25 ------- testing/marionette/logging.js | 75 ------------------- 5 files changed, 2 insertions(+), 142 deletions(-) delete mode 100644 testing/marionette/logging.js diff --git a/testing/marionette/driver.js b/testing/marionette/driver.js index a9b271e00ff7..f7d41f722140 100644 --- a/testing/marionette/driver.js +++ b/testing/marionette/driver.js @@ -31,7 +31,6 @@ Cu.import("chrome://marionette/content/event.js"); Cu.import("chrome://marionette/content/interaction.js"); Cu.import("chrome://marionette/content/l10n.js"); Cu.import("chrome://marionette/content/legacyaction.js"); -Cu.import("chrome://marionette/content/logging.js"); Cu.import("chrome://marionette/content/modal.js"); Cu.import("chrome://marionette/content/proxy.js"); Cu.import("chrome://marionette/content/session.js"); @@ -126,7 +125,6 @@ this.GeckoDriver = function (appName, server) { this.timer = null; this.inactivityTimer = null; - this.marionetteLog = new logging.ContentLogger(); this.testName = null; this.capabilities = new session.Capabilities(); @@ -693,26 +691,6 @@ GeckoDriver.prototype.getSessionCapabilities = function (cmd, resp) { resp.body.capabilities = this.capabilities; }; -/** - * Log message. Accepts user defined log-level. - * - * @param {string} value - * Log message. - * @param {string} level - * Arbitrary log level. - */ -GeckoDriver.prototype.log = function (cmd, resp) { - // if level is null, we want to use ContentLogger#send's default - this.marionetteLog.log( - cmd.parameters.value, - cmd.parameters.level || undefined); -}; - -/** Return all logged messages. */ -GeckoDriver.prototype.getLogs = function (cmd, resp) { - resp.body = this.marionetteLog.get(); -}; - /** * Sets the context of the subsequent commands to be either "chrome" or * "content". @@ -894,10 +872,6 @@ GeckoDriver.prototype.execute_ = function (script, args, timeout, opts = {}) { case Context.CHROME: let sb = this.sandboxes.get(opts.sandboxName, opts.newSandbox); - if (opts.sandboxName) { - sb = sandbox.augment(sb, new logging.Adapter(this.marionetteLog)); - } - opts.timeout = timeout; let wargs = evaluate.fromJSON(args, this.curBrowser.seenEls, sb.window); return evaluate.sandbox(sb, script, wargs, opts) @@ -3090,13 +3064,6 @@ GeckoDriver.prototype.receiveMessage = function (message) { logger.info(message.json.message); break; - case "Marionette:shareData": - // log messages from tests - if (message.json.log) { - this.marionetteLog.addAll(message.json.log); - } - break; - case "Marionette:switchToModalOrigin": this.curBrowser.frameManager.switchToModalOrigin(message); this.mm = this.curBrowser.frameManager @@ -3235,8 +3202,6 @@ GeckoDriver.prototype.commands = { "sayHello": GeckoDriver.prototype.sayHello, "newSession": GeckoDriver.prototype.newSession, "getSessionCapabilities": GeckoDriver.prototype.getSessionCapabilities, - "log": GeckoDriver.prototype.log, - "getLogs": GeckoDriver.prototype.getLogs, "setContext": GeckoDriver.prototype.setContext, "getContext": GeckoDriver.prototype.getContext, "executeScript": GeckoDriver.prototype.executeScript, diff --git a/testing/marionette/harness/marionette_harness/marionette_test/testcases.py b/testing/marionette/harness/marionette_harness/marionette_test/testcases.py index 1ba3288ea16d..b4c18a3d30e4 100644 --- a/testing/marionette/harness/marionette_harness/marionette_test/testcases.py +++ b/testing/marionette/harness/marionette_harness/marionette_test/testcases.py @@ -311,9 +311,7 @@ class MarionetteTestCase(CommonTestCase): def setUp(self): super(MarionetteTestCase, self).setUp() self.marionette.test_name = self.test_name - self.marionette.execute_script("log('TEST-START: {0}')" - .format(self.test_name), - sandbox="simpletest") + self.logger.info("TEST-START: {}".format(self.test_name)) def tearDown(self): # In the case no session is active (eg. the application was quit), start @@ -323,9 +321,7 @@ class MarionetteTestCase(CommonTestCase): if not self.marionette.crashed: try: - self.marionette.execute_script("log('TEST-END: {0}')" - .format(self.test_name), - sandbox="simpletest") + self.logger.info("TEST-END: {}".format(self.test_name)) self.marionette.test_name = None except (MarionetteException, IOError): # We have tried to log the test end when there is no listener diff --git a/testing/marionette/jar.mn b/testing/marionette/jar.mn index ac4f98a3d724..e0aa8c3effa7 100644 --- a/testing/marionette/jar.mn +++ b/testing/marionette/jar.mn @@ -25,7 +25,6 @@ marionette.jar: content/cookies.js (cookies.js) content/atom.js (atom.js) content/evaluate.js (evaluate.js) - content/logging.js (logging.js) content/navigate.js (navigate.js) content/l10n.js (l10n.js) content/assert.js (assert.js) diff --git a/testing/marionette/listener.js b/testing/marionette/listener.js index b76d488edde6..321829e29727 100644 --- a/testing/marionette/listener.js +++ b/testing/marionette/listener.js @@ -23,7 +23,6 @@ Cu.import("chrome://marionette/content/evaluate.js"); Cu.import("chrome://marionette/content/event.js"); Cu.import("chrome://marionette/content/interaction.js"); Cu.import("chrome://marionette/content/legacyaction.js"); -Cu.import("chrome://marionette/content/logging.js"); Cu.import("chrome://marionette/content/navigate.js"); Cu.import("chrome://marionette/content/proxy.js"); Cu.import("chrome://marionette/content/session.js"); @@ -35,8 +34,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.importGlobalProperties(["URL"]); -var contentLog = new logging.ContentLogger(); - var marionetteTestName; var winUtil = content.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindowUtils); @@ -675,13 +672,6 @@ function sendError(err, uuid) { sendToServer(uuid, err); } -/** - * Send log message to server - */ -function sendLog(msg) { - sendToServer("Marionette:log", {message: msg}); -} - /** * Clear test values after completion of test */ @@ -739,18 +729,11 @@ function* executeInSandbox(script, args, timeout, opts) { opts.timeout = timeout; let sb = sandboxes.get(opts.sandboxName, opts.newSandbox); - if (opts.sandboxName) { - sb = sandbox.augment(sb, new logging.Adapter(contentLog)); - } - let wargs = evaluate.fromJSON( args, seenEls, curContainer.frame, curContainer.shadowRoot); let evaluatePromise = evaluate.sandbox(sb, script, wargs, opts); let res = yield evaluatePromise; - sendSyncMessage( - "Marionette:shareData", - {log: evaluate.toJSON(contentLog.get(), seenEls)}); return evaluate.toJSON(res, seenEls); } @@ -782,14 +765,6 @@ function emitTouchEvent(type, touch) { } } // we get here if we're not in asyncPacZoomEnabled land, or if we're the main process - /* - Disabled per bug 888303 - contentLog.log(loggingInfo, "TRACE"); - sendSyncMessage( - "Marionette:shareData", - {log: evaluate.toJSON(contentLog.get(), seenEls)}); - contentLog.clear(); - */ let domWindowUtils = curContainer.frame.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils); domWindowUtils.sendTouchEvent(type, [touch.identifier], [touch.clientX], [touch.clientY], [touch.radiusX], [touch.radiusY], [touch.rotationAngle], [touch.force], 1, 0); } diff --git a/testing/marionette/logging.js b/testing/marionette/logging.js deleted file mode 100644 index d77adfb0cbfe..000000000000 --- a/testing/marionette/logging.js +++ /dev/null @@ -1,75 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -this.EXPORTED_SYMBOLS = ["logging"]; - -this.logging = {}; - -/** Simple logger that is used in Simple Test harness tests. */ -logging.ContentLogger = class { - constructor() { - this.logs_ = []; - } - - /** - * Append a log entry. - * - * @param {string} message - * Log entry message. - * @param {string=} level - * Severity of entry. Defaults to "INFO". - */ - log(message, level = "INFO") { - let now = (new Date()).toString(); - this.logs_.push([level, message, now]); - } - - /** - * Append array of log entries. - * - * @param {Array.>} messages - * List of log entries, that are of the form severity, message, - * and date. - */ - addAll(messages) { - for (let message of messages) { - this.logs_.push(message); - } - } - - /** - * Gets current log entries and clears the cache. - * - * @return {Array.>} - * Log entries of the form severity, message, and date. - */ - get() { - let logs = this.logs_; - this.logs_ = []; - return logs; - } -}; - -/** - * Adapts an instance of ContentLogger for use in a sandbox. Is consumed - * by sandbox.augment. - */ -logging.Adapter = class { - constructor(logger = null) { - this.logger = logger; - } - - get exports() { - return new Map([["log", this.log.bind(this)]]); - } - - log(message, level = "INFO") { - dump(`MARIONETTE LOG: ${level}: ${message}\n`); - if (this.logger) { - this.logger.log(message, level); - } - } -};