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 379274 cd8a7b46639c04e6b89157d1283a0d34f8602889
parent 379273 8016d994c82a9b29a7865020fc52b7521b376b96
child 379275 f27a702a0d95931e8ff46dc531d1b42845812470
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo, test-only
bugs1342162
milestone53.0
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).
 
         """