Bug 1318724 - Increase the HTTP connection timeout for WebDriver tests, r=ato
authorJames Graham <james@hoppipolla.co.uk>
Thu, 23 Mar 2017 18:19:45 +0000
changeset 354019 ab00229faf2cde3509730ce14f5aed8cf49ed6dd
parent 354018 34c41d2a522709b73ecccfea1c28e3f4d4b62d07
child 354020 e3e321ce75dfa7d31a154cbdfca9641d1a4a839b
push id89391
push userjames@hoppipolla.co.uk
push dateThu, 20 Apr 2017 10:00:08 +0000
treeherdermozilla-inbound@1902130057ea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1318724
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1318724 - Increase the HTTP connection timeout for WebDriver tests, r=ato The 5s timeout was not enough for debug builds. I don't really see a reason to use something other than the default socket timeout here. MozReview-Commit-ID: Fm5lgSI3lFb
testing/web-platform/tests/tools/webdriver/webdriver/client.py
testing/web-platform/tests/tools/webdriver/webdriver/transport.py
--- a/testing/web-platform/tests/tools/webdriver/webdriver/client.py
+++ b/testing/web-platform/tests/tools/webdriver/webdriver/client.py
@@ -329,18 +329,17 @@ class UserPrompt(object):
     @command
     def text(self, value):
         body = {"value": list(value)}
         self.session.send_session_command("POST", "alert/text", body=body)
 
 
 class Session(object):
     def __init__(self, host, port, url_prefix="/", desired_capabilities=None,
-                 required_capabilities=None, timeout=transport.HTTP_TIMEOUT,
-                 extension=None):
+                 required_capabilities=None, extension=None, timeout=None):
         self.transport = transport.HTTPWireProtocol(
             host, port, url_prefix, timeout=timeout)
         self.desired_capabilities = desired_capabilities
         self.required_capabilities = required_capabilities
         self.session_id = None
         self.timeouts = None
         self.window = None
         self.find = None
--- a/testing/web-platform/tests/tools/webdriver/webdriver/transport.py
+++ b/testing/web-platform/tests/tools/webdriver/webdriver/transport.py
@@ -1,17 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import httplib
 import json
 import urlparse
 
-HTTP_TIMEOUT = 5
 
 class Response(object):
     """Describes an HTTP response received from a remote en"Describes an HTTP
     response received from a remote end whose body has been read and parsed as
     appropriate."""
     def __init__(self, status, body):
         self.status = status
         self.body = body
@@ -42,22 +41,23 @@ class Response(object):
             # SpecID: dfn-send-a-response
             #
             # > 4. If data is not null, let response's body be a JSON Object
             #      with a key `value` set to the JSON Serialization of data.
             assert "value" in body
 
         return cls(status, body)
 
+
 class HTTPWireProtocol(object):
     """Transports messages (commands and responses) over the WebDriver
     wire protocol.
     """
 
-    def __init__(self, host, port, url_prefix="/", timeout=HTTP_TIMEOUT):
+    def __init__(self, host, port, url_prefix="/", timeout=None):
         """Construct interface for communicating with the remote server.
 
         :param url: URL of remote WebDriver server.
         :param wait: Duration to wait for remote to appear.
         """
 
         self.host = host
         self.port = port
@@ -89,18 +89,22 @@ class HTTPWireProtocol(object):
         if isinstance(body, unicode):
             body = body.encode("utf-8")
 
         if headers is None:
             headers = {}
 
         url = self.url_prefix + url
 
+        kwargs = {}
+        if self._timeout is not None:
+            kwargs["timeout"] = self._timeout
+
         conn = httplib.HTTPConnection(
-            self.host, self.port, strict=True, timeout=self._timeout)
+            self.host, self.port, strict=True, **kwargs)
         conn.request(method, url, body, headers)
 
         try:
             response = Response.from_http_response(conn.getresponse())
         finally:
             conn.close()
 
         return response