Bug 1375425 - Remove deprecated commands; r?automatedtester draft
authorAndreas Tolfsen <ato@sny.no>
Thu, 22 Jun 2017 10:42:55 +0100
changeset 599070 d77131806dba61094448b452c35a89b0ecc9c6e2
parent 599069 0a3f0573e749fe9ff51afb70766284c9a9137b8c
child 599071 c1c8fcfcc351f95f5ed680f7a903889adc9bf759
push id65422
push userbmo:ato@sny.no
push dateThu, 22 Jun 2017 17:49:17 +0000
reviewersautomatedtester
bugs1375425
milestone56.0a1
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
testing/geckodriver/src/marionette.rs
testing/marionette/client/marionette_driver/marionette.py
testing/marionette/client/marionette_driver/timeout.py
testing/marionette/driver.js
testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py
--- a/testing/geckodriver/src/marionette.rs
+++ b/testing/geckodriver/src/marionette.rs
@@ -979,31 +979,31 @@ impl MarionetteCommand {
                 legacy_caps.insert("desiredCapabilities".to_string(), caps.to_json());
                 data.insert("capabilities".to_string(), legacy_caps.to_json());
 
                 (Some("newSession"), Some(Ok(data)))
             },
             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())),
             GetCurrentUrl => (Some("getCurrentUrl"), None),
             GoBack => (Some("goBack"), None),
             GoForward => (Some("goForward"), None),
             Refresh => (Some("refresh"), None),
             GetTitle => (Some("getTitle"), None),
             GetPageSource => (Some("getPageSource"), None),
             GetWindowHandle => (Some("getWindowHandle"), None),
             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),
             FullscreenWindow => (Some("fullscreenWindow"), None),
             SwitchToWindow(ref x) => (Some("switchToWindow"), Some(x.to_marionette())),
             SwitchToFrame(ref x) => (Some("switchToFrame"), Some(x.to_marionette())),
             SwitchToParentFrame => (Some("switchToParentFrame"), None),
             FindElement(ref x) => (Some("findElement"), Some(x.to_marionette())),
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -1054,19 +1054,17 @@ class Marionette(object):
             if canceled:
                 raise errors.MarionetteException(
                     "Something cancelled the quit application request")
 
         body = None
         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):
         """Terminate the currently running instance.
 
         This command will delete the active marionette session. It also allows
         manipulation of eg. the profile data while the application is not running.
         To start the application again, :func:`start_session` has to be called.
--- a/testing/marionette/client/marionette_driver/timeout.py
+++ b/testing/marionette/client/marionette_driver/timeout.py
@@ -24,21 +24,17 @@ class Timeouts(object):
 
     """
 
     def __init__(self, marionette):
         self._marionette = marionette
 
     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")
         if name not in ts:
             raise KeyError()
         ms = ts[name]
         return ms / 1000
 
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -1667,30 +1667,18 @@ GeckoDriver.prototype.getTimeouts = func
  *     Dictionary of timeout types and their new value, where all timeout
  *     types are optional.
  *
  * @throws {InvalidArgumentError}
  *     If timeout type key is unknown, or the value provided with it is
  *     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);
 };
 
 /** Single tap. */
 GeckoDriver.prototype.singleTap = function*(cmd, resp) {
   assert.window(this.getCurrentWindow());
 
   let {id, x, y} = cmd.parameters;
@@ -3198,17 +3186,16 @@ GeckoDriver.prototype.localizeProperty =
 
 GeckoDriver.prototype.commands = {
   "newSession": GeckoDriver.prototype.newSession,
   "getSessionCapabilities": GeckoDriver.prototype.getSessionCapabilities,
   "setContext": GeckoDriver.prototype.setContext,
   "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,
   "releaseActions": GeckoDriver.prototype.releaseActions,
   "actionChain": GeckoDriver.prototype.actionChain, // deprecated
   "multiAction": GeckoDriver.prototype.multiAction, // deprecated
   "executeAsyncScript": GeckoDriver.prototype.executeAsyncScript,
   "executeJSScript": GeckoDriver.prototype.executeJSScript,
@@ -3264,17 +3251,16 @@ GeckoDriver.prototype.commands = {
   "setWindowSize": GeckoDriver.prototype.setWindowRect, // Redirecting for compatibility
   "maximizeWindow": GeckoDriver.prototype.maximizeWindow,
   "fullscreen": GeckoDriver.prototype.fullscreen,
   "dismissDialog": GeckoDriver.prototype.dismissDialog,
   "acceptDialog": GeckoDriver.prototype.acceptDialog,
   "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,
   "localization:l10n:localizeProperty": GeckoDriver.prototype.localizeProperty,
 
   "addon:install": GeckoDriver.prototype.installAddon,
   "addon:uninstall": GeckoDriver.prototype.uninstallAddon,
 };
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py
@@ -92,27 +92,16 @@ class TestTimeouts(MarionetteTestCase):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         self.marionette.timeout.script = 1
         self.assertTrue(self.marionette.execute_async_script("""
              var callback = arguments[arguments.length - 1];
              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)
 
     def test_deprecated_set_script_timeout(self):
         self.marionette.set_script_timeout(2000)
         self.assertEqual(2, self.marionette.timeout.script)