Bug 1337743 - Rename quitApplication command quit; r?whimboo draft
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 27 Mar 2017 12:53:27 +0100
changeset 551809 732dd2870958cf9ab021fc08239ba48478281b63
parent 551799 e4fff0f4e79a077f72ff8675c2ff3348adf1a162
child 621639 7df7dc2ac8f223b981d5c574abddcea9074bc171
push id51158
push userbmo:ato@mozilla.com
push dateMon, 27 Mar 2017 13:54:54 +0000
reviewerswhimboo
bugs1337743
milestone55.0a1
Bug 1337743 - Rename quitApplication command quit; r?whimboo This shortens the name of the quitApplication Marionette command to `quit'. The client is not updated since it is used for Firefox upgrade tests. It can be updated to use `quit' when Firefox 56 ships. MozReview-Commit-ID: Gq5KWMS1AzF
testing/marionette/client/marionette_driver/marionette.py
testing/marionette/driver.js
testing/marionette/harness/marionette_harness/tests/unit/test_quit_restart.py
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -1142,17 +1142,17 @@ class Marionette(object):
             flags ending with `"Quit"` are present.
 
         :throws InvalidArgumentException: If there are multiple
             `shutdown_flags` ending with `"Quit"`.
 
         """
 
         # The vast majority of this function was implemented inside
-        # the quitApplication command as part of bug 1337743, and can be
+        # the quit command as part of bug 1337743, and can be
         # removed from here in Firefox 55 at the earliest.
 
         # remove duplicates
         flags = set(shutdown_flags)
 
         # add eAttemptQuit if there are no *Quits
         if not any(flag.endswith("Quit") for flag in flags):
             flags = flags | set(("eAttemptQuit",))
@@ -1170,16 +1170,19 @@ 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)
 
     @do_process_check
     def quit(self, 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.
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -2732,17 +2732,17 @@ GeckoDriver.prototype.acceptConnections 
  *     Explaining the reason why the application quit.  This can be
  *     in response to a normal shutdown or restart, yielding "shutdown"
  *     or "restart", respectively.
  *
  * @throws {InvalidArgumentError}
  *     If |flags| contains unknown or incompatible flags, for example
  *     multiple Quit flags.
  */
-GeckoDriver.prototype.quitApplication = function* (cmd, resp) {
+GeckoDriver.prototype.quit = function* (cmd, resp) {
   const quits = ["eConsiderQuit", "eAttemptQuit", "eForceQuit"];
 
   let flags = [];
   if (typeof cmd.parameters.flags != "undefined") {
     flags = assert.array(cmd.parameters.flags);
   }
 
   // bug 1298921
@@ -3050,17 +3050,18 @@ GeckoDriver.prototype.commands = {
   "getWindowSize": GeckoDriver.prototype.getWindowSize,
   "setWindowSize": GeckoDriver.prototype.setWindowSize,
   "maximizeWindow": GeckoDriver.prototype.maximizeWindow,
   "dismissDialog": GeckoDriver.prototype.dismissDialog,
   "acceptDialog": GeckoDriver.prototype.acceptDialog,
   "getTextFromDialog": GeckoDriver.prototype.getTextFromDialog,
   "sendKeysToDialog": GeckoDriver.prototype.sendKeysToDialog,
   "acceptConnections": GeckoDriver.prototype.acceptConnections,
-  "quitApplication": GeckoDriver.prototype.quitApplication,
+  "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_quit_restart.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_quit_restart.py
@@ -14,17 +14,17 @@ class TestServerQuitApplication(Marionet
             self.marionette.start_session()
 
     def quit(self, flags=None):
         body = None
         if flags is not None:
             body = {"flags": list(flags)}
 
         try:
-            resp = self.marionette._send_message("quitApplication", body)
+            resp = self.marionette._send_message("quit", body)
         finally:
             self.marionette.session_id = None
             self.marionette.session = None
             self.marionette.process_id = None
             self.marionette.profile = None
             self.marionette.window = None
 
         self.assertIn("cause", resp)
@@ -33,17 +33,17 @@ class TestServerQuitApplication(Marionet
         self.marionette.instance.runner.wait()
 
         return resp["cause"]
 
     def test_types(self):
         for typ in [42, True, "foo", []]:
             print("testing type {}".format(type(typ)))
             with self.assertRaises(errors.InvalidArgumentException):
-                self.marionette._send_message("quitApplication", typ)
+                self.marionette._send_message("quit", typ)
 
         with self.assertRaises(errors.InvalidArgumentException):
             self.quit("foo")
 
     def test_undefined_default(self):
         cause = self.quit()
         self.assertEqual("shutdown", cause)