зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1370863 - Remove log and getLogs commands from Marionette; r=automatedtester
MozReview-Commit-ID: HFZfJGwSqyT --HG-- extra : rebase_source : eb04f0a3fa55d17eb5fef9bff3170ba5ce147eff
This commit is contained in:
Родитель
66f9611734
Коммит
f2225720a9
|
@ -31,7 +31,6 @@ Cu.import("chrome://marionette/content/event.js");
|
||||||
Cu.import("chrome://marionette/content/interaction.js");
|
Cu.import("chrome://marionette/content/interaction.js");
|
||||||
Cu.import("chrome://marionette/content/l10n.js");
|
Cu.import("chrome://marionette/content/l10n.js");
|
||||||
Cu.import("chrome://marionette/content/legacyaction.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/modal.js");
|
||||||
Cu.import("chrome://marionette/content/proxy.js");
|
Cu.import("chrome://marionette/content/proxy.js");
|
||||||
Cu.import("chrome://marionette/content/session.js");
|
Cu.import("chrome://marionette/content/session.js");
|
||||||
|
@ -126,7 +125,6 @@ this.GeckoDriver = function (appName, server) {
|
||||||
this.timer = null;
|
this.timer = null;
|
||||||
this.inactivityTimer = null;
|
this.inactivityTimer = null;
|
||||||
|
|
||||||
this.marionetteLog = new logging.ContentLogger();
|
|
||||||
this.testName = null;
|
this.testName = null;
|
||||||
|
|
||||||
this.capabilities = new session.Capabilities();
|
this.capabilities = new session.Capabilities();
|
||||||
|
@ -693,26 +691,6 @@ GeckoDriver.prototype.getSessionCapabilities = function (cmd, resp) {
|
||||||
resp.body.capabilities = this.capabilities;
|
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
|
* Sets the context of the subsequent commands to be either "chrome" or
|
||||||
* "content".
|
* "content".
|
||||||
|
@ -894,10 +872,6 @@ GeckoDriver.prototype.execute_ = function (script, args, timeout, opts = {}) {
|
||||||
|
|
||||||
case Context.CHROME:
|
case Context.CHROME:
|
||||||
let sb = this.sandboxes.get(opts.sandboxName, opts.newSandbox);
|
let sb = this.sandboxes.get(opts.sandboxName, opts.newSandbox);
|
||||||
if (opts.sandboxName) {
|
|
||||||
sb = sandbox.augment(sb, new logging.Adapter(this.marionetteLog));
|
|
||||||
}
|
|
||||||
|
|
||||||
opts.timeout = timeout;
|
opts.timeout = timeout;
|
||||||
let wargs = evaluate.fromJSON(args, this.curBrowser.seenEls, sb.window);
|
let wargs = evaluate.fromJSON(args, this.curBrowser.seenEls, sb.window);
|
||||||
return evaluate.sandbox(sb, script, wargs, opts)
|
return evaluate.sandbox(sb, script, wargs, opts)
|
||||||
|
@ -3090,13 +3064,6 @@ GeckoDriver.prototype.receiveMessage = function (message) {
|
||||||
logger.info(message.json.message);
|
logger.info(message.json.message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Marionette:shareData":
|
|
||||||
// log messages from tests
|
|
||||||
if (message.json.log) {
|
|
||||||
this.marionetteLog.addAll(message.json.log);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "Marionette:switchToModalOrigin":
|
case "Marionette:switchToModalOrigin":
|
||||||
this.curBrowser.frameManager.switchToModalOrigin(message);
|
this.curBrowser.frameManager.switchToModalOrigin(message);
|
||||||
this.mm = this.curBrowser.frameManager
|
this.mm = this.curBrowser.frameManager
|
||||||
|
@ -3235,8 +3202,6 @@ GeckoDriver.prototype.commands = {
|
||||||
"sayHello": GeckoDriver.prototype.sayHello,
|
"sayHello": GeckoDriver.prototype.sayHello,
|
||||||
"newSession": GeckoDriver.prototype.newSession,
|
"newSession": GeckoDriver.prototype.newSession,
|
||||||
"getSessionCapabilities": GeckoDriver.prototype.getSessionCapabilities,
|
"getSessionCapabilities": GeckoDriver.prototype.getSessionCapabilities,
|
||||||
"log": GeckoDriver.prototype.log,
|
|
||||||
"getLogs": GeckoDriver.prototype.getLogs,
|
|
||||||
"setContext": GeckoDriver.prototype.setContext,
|
"setContext": GeckoDriver.prototype.setContext,
|
||||||
"getContext": GeckoDriver.prototype.getContext,
|
"getContext": GeckoDriver.prototype.getContext,
|
||||||
"executeScript": GeckoDriver.prototype.executeScript,
|
"executeScript": GeckoDriver.prototype.executeScript,
|
||||||
|
|
|
@ -311,9 +311,7 @@ class MarionetteTestCase(CommonTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(MarionetteTestCase, self).setUp()
|
super(MarionetteTestCase, self).setUp()
|
||||||
self.marionette.test_name = self.test_name
|
self.marionette.test_name = self.test_name
|
||||||
self.marionette.execute_script("log('TEST-START: {0}')"
|
self.logger.info("TEST-START: {}".format(self.test_name))
|
||||||
.format(self.test_name),
|
|
||||||
sandbox="simpletest")
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# In the case no session is active (eg. the application was quit), start
|
# 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:
|
if not self.marionette.crashed:
|
||||||
try:
|
try:
|
||||||
self.marionette.execute_script("log('TEST-END: {0}')"
|
self.logger.info("TEST-END: {}".format(self.test_name))
|
||||||
.format(self.test_name),
|
|
||||||
sandbox="simpletest")
|
|
||||||
self.marionette.test_name = None
|
self.marionette.test_name = None
|
||||||
except (MarionetteException, IOError):
|
except (MarionetteException, IOError):
|
||||||
# We have tried to log the test end when there is no listener
|
# We have tried to log the test end when there is no listener
|
||||||
|
|
|
@ -25,7 +25,6 @@ marionette.jar:
|
||||||
content/cookies.js (cookies.js)
|
content/cookies.js (cookies.js)
|
||||||
content/atom.js (atom.js)
|
content/atom.js (atom.js)
|
||||||
content/evaluate.js (evaluate.js)
|
content/evaluate.js (evaluate.js)
|
||||||
content/logging.js (logging.js)
|
|
||||||
content/navigate.js (navigate.js)
|
content/navigate.js (navigate.js)
|
||||||
content/l10n.js (l10n.js)
|
content/l10n.js (l10n.js)
|
||||||
content/assert.js (assert.js)
|
content/assert.js (assert.js)
|
||||||
|
|
|
@ -23,7 +23,6 @@ Cu.import("chrome://marionette/content/evaluate.js");
|
||||||
Cu.import("chrome://marionette/content/event.js");
|
Cu.import("chrome://marionette/content/event.js");
|
||||||
Cu.import("chrome://marionette/content/interaction.js");
|
Cu.import("chrome://marionette/content/interaction.js");
|
||||||
Cu.import("chrome://marionette/content/legacyaction.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/navigate.js");
|
||||||
Cu.import("chrome://marionette/content/proxy.js");
|
Cu.import("chrome://marionette/content/proxy.js");
|
||||||
Cu.import("chrome://marionette/content/session.js");
|
Cu.import("chrome://marionette/content/session.js");
|
||||||
|
@ -35,8 +34,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
Cu.importGlobalProperties(["URL"]);
|
Cu.importGlobalProperties(["URL"]);
|
||||||
|
|
||||||
var contentLog = new logging.ContentLogger();
|
|
||||||
|
|
||||||
var marionetteTestName;
|
var marionetteTestName;
|
||||||
var winUtil = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
var winUtil = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIDOMWindowUtils);
|
.getInterface(Ci.nsIDOMWindowUtils);
|
||||||
|
@ -675,13 +672,6 @@ function sendError(err, uuid) {
|
||||||
sendToServer(uuid, err);
|
sendToServer(uuid, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Send log message to server
|
|
||||||
*/
|
|
||||||
function sendLog(msg) {
|
|
||||||
sendToServer("Marionette:log", {message: msg});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear test values after completion of test
|
* Clear test values after completion of test
|
||||||
*/
|
*/
|
||||||
|
@ -739,18 +729,11 @@ function* executeInSandbox(script, args, timeout, opts) {
|
||||||
opts.timeout = timeout;
|
opts.timeout = timeout;
|
||||||
|
|
||||||
let sb = sandboxes.get(opts.sandboxName, opts.newSandbox);
|
let sb = sandboxes.get(opts.sandboxName, opts.newSandbox);
|
||||||
if (opts.sandboxName) {
|
|
||||||
sb = sandbox.augment(sb, new logging.Adapter(contentLog));
|
|
||||||
}
|
|
||||||
|
|
||||||
let wargs = evaluate.fromJSON(
|
let wargs = evaluate.fromJSON(
|
||||||
args, seenEls, curContainer.frame, curContainer.shadowRoot);
|
args, seenEls, curContainer.frame, curContainer.shadowRoot);
|
||||||
let evaluatePromise = evaluate.sandbox(sb, script, wargs, opts);
|
let evaluatePromise = evaluate.sandbox(sb, script, wargs, opts);
|
||||||
|
|
||||||
let res = yield evaluatePromise;
|
let res = yield evaluatePromise;
|
||||||
sendSyncMessage(
|
|
||||||
"Marionette:shareData",
|
|
||||||
{log: evaluate.toJSON(contentLog.get(), seenEls)});
|
|
||||||
return evaluate.toJSON(res, 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
|
// 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);
|
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);
|
domWindowUtils.sendTouchEvent(type, [touch.identifier], [touch.clientX], [touch.clientY], [touch.radiusX], [touch.radiusY], [touch.rotationAngle], [touch.force], 1, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.<Array<string, string, string>>} 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.<Array<string, string, string>>}
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
Загрузка…
Ссылка в новой задаче