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 349798 5827fdd9ac6d9283d6cc143a1657980bf462d6a8
parent 349797 fdbeb5e7c238c620aefe316773c6a958139cb6f5
child 349799 359ce548deb85a45ad9de6b9f15ff5f0b15b3f1f
push id31562
push userkwierso@gmail.com
push dateTue, 28 Mar 2017 00:03:39 +0000
treeherdermozilla-central@a8bb5c8e0e80 [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
@@ -313,18 +313,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