Bug 1322277 - Fix usage of capabilities in start_session. draft
authorHenrik Skupin <mail@hskupin.info>
Mon, 06 Feb 2017 13:03:18 +0100
changeset 479304 763507aaba4e2b71c1dd663551909b35833f8017
parent 479303 1cc159c7a0445ec51e335c8a1a1cceea7bbf8380
child 479305 32e4ef4cd43569642dd21a77ba29ae7c91db2f5d
push id44211
push userbmo:hskupin@gmail.com
push dateMon, 06 Feb 2017 12:18:11 +0000
bugs1322277
milestone54.0a1
Bug 1322277 - Fix usage of capabilities in start_session. Capabilities as passed into start_session() can be desiredCapabilities and requiredCapabilities. As such the parameter name should be clear. MozReview-Commit-ID: GPNv4g9HMO2
testing/marionette/client/marionette_driver/marionette.py
--- 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)
 
     @do_process_check
-    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):
             self.port,
             self.socket_timeout)
 
         # Call wait_for_port() before attempting to connect in
         # the event gecko hasn't started yet.
         self.wait_for_port(timeout=timeout)
         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")