Bug 1322277 - Fix usage of capabilities in start_session. r=ato
authorHenrik Skupin <mail@hskupin.info>
Mon, 06 Feb 2017 13:03:18 +0100
changeset 479611 755e183915530e9bd7b25af25aecd6949a9f162f
parent 479610 6332ef237e2145b7647d48cb90e39b27aed58a85
child 479612 9908b674ae2c30814cefdbd0f1d6373be1794caa
push id44315
push usertnguyen@mozilla.com
push dateTue, 07 Feb 2017 02:03:39 +0000
Bug 1322277 - Fix usage of capabilities in start_session. r=ato Capabilities as passed into start_session() can be desiredCapabilities and requiredCapabilities. As such the parameter name should be clear. MozReview-Commit-ID: GPNv4g9HMO2
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -1242,23 +1242,22 @@ class Marionette(object):
         Returns an absolute url for files served from Marionette's www directory.
         :param relative_url: The url of a static file, relative to Marionette's www directory.
         return "{0}{1}".format(self.baseurl, relative_url)
-    def start_session(self, desired_capabilities=None, session_id=None, timeout=60):
+    def start_session(self, capabilities=None, session_id=None, timeout=60):
         """Create a new Marionette session.
         This method must be called before performing any other action.
-        :param desired_capabilities: An optional dict of desired
-            capabilities.  This is currently ignored.
+        :param capabilities: An optional dict of desired or required capabilities.
         :param timeout: Timeout in seconds for the server to be ready.
         :param session_id: unique identifier for the session. If no session id is
             passed in then one will be generated by the marionette server.
         :returns: A dict of the capabilities offered.
         self.crashed = 0
@@ -1274,17 +1273,17 @@ class Marionette(object):
         # Call wait_for_port() before attempting to connect in
         # the event gecko hasn't started yet.
         self.protocol, _ = self.client.connect()
-        body = {"capabilities": desired_capabilities, "sessionId": session_id}
+        body = {"capabilities": capabilities, "sessionId": session_id}
         resp = self._send_message("newSession", body)
         self.session_id = resp["sessionId"]
         self.session = resp["value"] if self.protocol == 1 else resp["capabilities"]
         # fallback to processId can be removed in Firefox 55
         self.process_id = self.session.get("moz:processID", self.session.get("processId"))
         self.profile = self.session.get("moz:profile")