From 57445ac21fc17b8800fa4da79d458731fa265b1c Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Thu, 10 Nov 2016 18:29:55 +0000 Subject: [PATCH] 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 --- .../client/marionette_driver/marionette.py | 6 +++--- testing/marionette/driver.js | 14 ++++++++++++-- .../harness/marionette/tests/unit/test_timeouts.py | 4 ++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/testing/marionette/client/marionette_driver/marionette.py b/testing/marionette/client/marionette_driver/marionette.py index 4c0bbccc0f4d..f384d9debd70 100644 --- a/testing/marionette/client/marionette_driver/marionette.py +++ b/testing/marionette/client/marionette_driver/marionette.py @@ -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: diff --git a/testing/marionette/driver.js b/testing/marionette/driver.js index 30a7d65f6f62..dcd327b214af 100644 --- a/testing/marionette/driver.js +++ b/testing/marionette/driver.js @@ -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: , ms: } 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, diff --git a/testing/marionette/harness/marionette/tests/unit/test_timeouts.py b/testing/marionette/harness/marionette/tests/unit/test_timeouts.py index 283a81ab41dc..33604e723cd1 100644 --- a/testing/marionette/harness/marionette/tests/unit/test_timeouts.py +++ b/testing/marionette/harness/marionette/tests/unit/test_timeouts.py @@ -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)