Bug 1316622 - Rename Marionette command timeouts to setTimeouts; r=automatedtester,whimboo

This renames the `Marionette:timeouts` command
to `Marionette:setTimeouts`.  It should be fine to make this
backwards incompatible change as the `Marionette.set_script_timeout`,
`Marionette.set_search_timeout`, and `Marionette.set_page_load_timeout`
commands all have existing try...except behaviour for another backwards
incompatible change in Firefox 52.

MozReview-Commit-ID: 58RrXhE2tN3

--HG--
extra : rebase_source : 67a52d6c48d5c94fdd4eb4e1120223778a83e0c2
This commit is contained in:
Andreas Tolfsen 2016-11-10 18:29:55 +00:00
parent 8b0fb7a64d
commit 57445ac21f
3 changed files with 19 additions and 5 deletions

View File

@ -1341,7 +1341,7 @@ class Marionette(object):
"""
try:
self._send_message("timeouts", {"script": timeout})
self._send_message("setTimeouts", {"script": timeout})
except errors.MarionetteException as e:
# remove when 52.0a is stable
if "Not a Number" in e.message:
@ -1364,7 +1364,7 @@ class Marionette(object):
"""
try:
self._send_message("timeouts", {"implicit": timeout})
self._send_message("setTimeouts", {"implicit": timeout})
except errors.MarionetteException as e:
# remove when 52.0a is stable
if "Not a Number" in e.message:
@ -1383,7 +1383,7 @@ class Marionette(object):
"""
try:
self._send_message("timeouts", {"page load": timeout})
self._send_message("setTimeouts", {"page load": timeout})
except errors.MarionetteException as e:
# remove when 52.0a is stable
if "Not a Number" in e.message:

View File

@ -1539,6 +1539,14 @@ GeckoDriver.prototype.switchToFrame = function*(cmd, resp) {
}
};
GeckoDriver.prototype.getTimeouts = function(cmd, resp) {
return {
"implicit": this.searchTimeout,
"script": this.scriptTimeout,
"page load": this.pageTimeout,
};
};
/**
* Set timeout for page loading, searching, and scripts.
*
@ -1550,7 +1558,7 @@ GeckoDriver.prototype.switchToFrame = function*(cmd, resp) {
* If timeout type key is unknown, or the value provided with it is
* not an integer.
*/
GeckoDriver.prototype.timeouts = function(cmd, resp) {
GeckoDriver.prototype.setTimeouts = function(cmd, resp) {
// backwards compatibility with old API
// that accepted a dictionary {type: <string>, ms: <number>}
let timeouts = {};
@ -2805,7 +2813,9 @@ GeckoDriver.prototype.commands = {
"setContext": GeckoDriver.prototype.setContext,
"getContext": GeckoDriver.prototype.getContext,
"executeScript": GeckoDriver.prototype.executeScript,
"timeouts": GeckoDriver.prototype.timeouts,
"getTimeouts": GeckoDriver.prototype.getTimeouts,
"timeouts": GeckoDriver.prototype.setTimeouts, // deprecated until Firefox 55
"setTimeouts": GeckoDriver.prototype.setTimeouts,
"singleTap": GeckoDriver.prototype.singleTap,
"actionChain": GeckoDriver.prototype.actionChain,
"multiAction": GeckoDriver.prototype.multiAction,

View File

@ -80,4 +80,8 @@ class TestTimeouts(MarionetteTestCase):
# 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)