Bug 1715517 - [marionette] Only return moz:debuggerAddress capability if CDP is active. r=webdriver-reviewers,jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D117289
This commit is contained in:
Henrik Skupin 2021-06-14 07:01:54 +00:00
Родитель 714e4c72eb
Коммит fbc78630d6
2 изменённых файлов: 25 добавлений и 14 удалений

Просмотреть файл

@ -23,23 +23,14 @@ XPCOMUtils.defineLazyModuleGetters(this, {
AppInfo: "chrome://remote/content/marionette/appinfo.js",
assert: "chrome://remote/content/marionette/assert.js",
error: "chrome://remote/content/marionette/error.js",
Log: "chrome://remote/content/marionette/log.js",
pprint: "chrome://remote/content/marionette/format.js",
RemoteAgent: "chrome://remote/content/components/RemoteAgent.jsm",
});
XPCOMUtils.defineLazyGlobalGetters(this, ["URL"]);
XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
XPCOMUtils.defineLazyGetter(this, "remoteAgent", () => {
// The Remote Agent is currently not available on Android, and all
// release channels (bug 1606604),
try {
return Cc["@mozilla.org/remote/agent;1"].createInstance(Ci.nsIRemoteAgent);
} catch (e) {
logger.debug("Remote agent not available for this build and platform");
return null;
}
return Cc["@mozilla.org/remote/agent;1"].createInstance(Ci.nsIRemoteAgent);
});
/** Representation of WebDriver session timeouts. */
@ -446,7 +437,11 @@ class Capabilities extends Map {
// proprietary
["moz:accessibilityChecks", false],
["moz:buildID", AppInfo.appBuildID],
["moz:debuggerAddress", remoteAgent?.debuggerAddress || null],
[
"moz:debuggerAddress",
// With bug 1715481 fixed always use the Remote Agent instance
RemoteAgent.cdp ? remoteAgent.debuggerAddress : null,
],
[
"moz:headless",
Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo).isHeadless,

Просмотреть файл

@ -23,15 +23,31 @@ class TestCommandLineArguments(MarionetteTestCase):
super(TestCommandLineArguments, self).tearDown()
def test_remote_agent_enabled(self):
def test_debugger_address_cdp_status(self):
# By default Remote Agent is not enabled
debugger_address = self.marionette.session_capabilities.get(
"moz:debuggerAddress"
)
self.assertIsNone(debugger_address)
self.marionette.instance.app_args.append("-remote-debugging-port")
# With BiDi only enabled the capability doesn't have to be returned
self.marionette.enforce_gecko_prefs({"remote.active-protocols": 1})
try:
self.marionette.quit()
self.marionette.instance.app_args.append("-remote-debugging-port")
self.marionette.start_session()
debugger_address = self.marionette.session_capabilities.get(
"moz:debuggerAddress"
)
self.assertIsNone(debugger_address)
finally:
self.marionette.clear_pref("remote.active-protocols")
self.marionette.restart()
# With all protocols enabled the capability has to be returned
self.marionette.quit()
self.marionette.instance.switch_profile()
self.marionette.start_session()
debugger_address = self.marionette.session_capabilities.get(