Bug 1375425 - Remove deprecated commands; r=automatedtester

The "timeouts" command could have been removed in Firefox 55, and
"quitApplication" can be removed with Firefox 56.

MozReview-Commit-ID: Fe7x8Yy0vSb

--HG--
extra : rebase_source : fc8b2c3c27f76a472cbdd8681efff06ca60e00f7
This commit is contained in:
Andreas Tolfsen 2017-06-22 10:42:55 +01:00
parent 3b4771f13f
commit 5c81559723
5 changed files with 5 additions and 36 deletions

View File

@ -984,7 +984,7 @@ impl MarionetteCommand {
DeleteSession => {
let mut body = BTreeMap::new();
body.insert("flags".to_owned(), vec!["eForceQuit".to_json()].to_json());
(Some("quitApplication"), Some(Ok(body)))
(Some("quit"), Some(Ok(body)))
},
Status => panic!("Got status command that should already have been handled"),
Get(ref x) => (Some("get"), Some(x.to_marionette())),
@ -998,7 +998,7 @@ impl MarionetteCommand {
GetWindowHandles => (Some("getWindowHandles"), None),
CloseWindow => (Some("close"), None),
GetTimeouts => (Some("getTimeouts"), None),
SetTimeouts(ref x) => (Some("timeouts"), Some(x.to_marionette())),
SetTimeouts(ref x) => (Some("setTimeouts"), Some(x.to_marionette())),
SetWindowRect(ref x) => (Some("setWindowRect"), Some(x.to_marionette())),
GetWindowRect => (Some("getWindowRect"), None),
MaximizeWindow => (Some("maximizeWindow"), None),

View File

@ -1059,9 +1059,7 @@ class Marionette(object):
if len(flags) > 0:
body = {"flags": list(flags)}
# quitApplication was renamed quit in bug 1337743,
# and this can safely be renamed when Firefox 56 becomes stable
self._send_message("quitApplication", body)
self._send_message("quit", body)
@do_process_check
def quit(self, clean=False, in_app=False, callback=None):

View File

@ -29,11 +29,7 @@ class Timeouts(object):
def _set(self, name, sec):
ms = sec * 1000
try:
self._marionette._send_message("setTimeouts", {name: ms})
except errors.UnknownCommandException:
# remove when 55 is stable
self._marionette._send_message("timeouts", {"type": name, "ms": ms})
self._marionette._send_message("setTimeouts", {name: ms})
def _get(self, name):
ts = self._marionette._send_message("getTimeouts")

View File

@ -1672,20 +1672,8 @@ GeckoDriver.prototype.getTimeouts = function (cmd, resp) {
* not an integer.
*/
GeckoDriver.prototype.setTimeouts = function (cmd, resp) {
// backwards compatibility with old API
// that accepted a dictionary {type: <string>, ms: <number>}
let json = {};
if (typeof cmd.parameters == "object" &&
"type" in cmd.parameters &&
"ms" in cmd.parameters) {
logger.warn("Using deprecated data structure for setting timeouts");
json = {[cmd.parameters.type]: parseInt(cmd.parameters.ms)};
} else {
json = cmd.parameters;
}
// merge with existing timeouts
let merged = Object.assign(this.timeouts.toJSON(), json);
let merged = Object.assign(this.timeouts.toJSON(), cmd.parameters);
this.timeouts = session.Timeouts.fromJSON(merged);
};
@ -3203,7 +3191,6 @@ GeckoDriver.prototype.commands = {
"getContext": GeckoDriver.prototype.getContext,
"executeScript": GeckoDriver.prototype.executeScript,
"getTimeouts": GeckoDriver.prototype.getTimeouts,
"timeouts": GeckoDriver.prototype.setTimeouts, // deprecated until Firefox 55
"setTimeouts": GeckoDriver.prototype.setTimeouts,
"singleTap": GeckoDriver.prototype.singleTap,
"performActions": GeckoDriver.prototype.performActions,
@ -3269,7 +3256,6 @@ GeckoDriver.prototype.commands = {
"getTextFromDialog": GeckoDriver.prototype.getTextFromDialog,
"sendKeysToDialog": GeckoDriver.prototype.sendKeysToDialog,
"acceptConnections": GeckoDriver.prototype.acceptConnections,
"quitApplication": GeckoDriver.prototype.quit, // deprecated, can be removed in Firefox 56
"quit": GeckoDriver.prototype.quit,
"localization:l10n:localizeEntity": GeckoDriver.prototype.localizeEntity,

View File

@ -97,17 +97,6 @@ class TestTimeouts(MarionetteTestCase):
setTimeout(function() { callback(true); }, 500);
"""))
def test_compat_input_types(self):
# When using the spec-incompatible input format which we have
# for backwards compatibility, it should be possible to send ms
# as a string type and have the server parseInt it to an integer.
body = {"type": "script", "ms": "30000"}
self.marionette._send_message("setTimeouts", body)
def test_deprecated_set_timeouts_command(self):
body = {"implicit": 3000}
self.marionette._send_message("timeouts", body)
def test_deprecated_set_search_timeout(self):
self.marionette.set_search_timeout(1000)
self.assertEqual(1, self.marionette.timeout.implicit)