Bug 1342162 - Make timeout API in client backwards compatible. r=whimboo, a=test-only
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 23 Mar 2017 16:22:34 +0000
changeset 395432 fb88f196fe8afbd73c9b5a5fe233a1baef264ddb
parent 395431 90b35818bd830cca7dd1a3ef731e75beeafd4180
child 395433 dfad67ea2996ce62c141ef5b29be84620411bf03
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo, test-only
bugs1342162
milestone54.0a2
Bug 1342162 - Make timeout API in client backwards compatible. r=whimboo, a=test-only This makes the session timeout duration configuration API backwards compatible with earlier Firefoxen. As Marionette changes to accept pageLoad, we must still continue to allow "page load" as a key for as long as the Marionette Python client is used for Firefox upgrade tests. MozReview-Commit-ID: Ln4D3bY2d7f
testing/marionette/client/marionette_driver/timeout.py
--- a/testing/marionette/client/marionette_driver/timeout.py
+++ b/testing/marionette/client/marionette_driver/timeout.py
@@ -31,17 +31,20 @@ class Timeouts(object):
         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})
 
     def _get(self, name):
-        ms = self._marionette._send_message("getTimeouts", key=name)
+        ts = self._marionette._send_message("getTimeouts")
+        if name not in ts:
+            raise KeyError()
+        ms = ts[name]
         return ms / 1000
 
     @property
     def script(self):
         """Get the session's script timeout.  This specifies the time
         to wait for injected scripts to finished before interrupting
         them. It is by default 30 seconds.
 
@@ -58,25 +61,33 @@ class Timeouts(object):
 
     @property
     def page_load(self):
         """Get the session's page load timeout.  This specifies the time
         to wait for the page loading to complete.  It is by default 5
         minutes (or 300 seconds).
 
         """
-        return self._get("pageLoad")
+        # remove fallback when Firefox 56 is stable
+        try:
+            return self._get("pageLoad")
+        except KeyError:
+            return self._get("page load")
 
     @page_load.setter
     def page_load(self, sec):
         """Set the session's page load timeout.  This specifies the time
         to wait for the page loading to complete.
 
         """
-        self._set("pageLoad", sec)
+        # remove fallback when Firefox 56 is stable
+        try:
+            self._set("pageLoad", sec)
+        except errors.InvalidArgumentException:
+            return self._set("page load", sec)
 
     @property
     def implicit(self):
         """Get the session's implicit wait timeout.  This specifies the
         time to wait for the implicit element location strategy when
         retrieving elements.  It is by default disabled (0 seconds).
 
         """