[WinCairo] Pass correct url for http test to test driver.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Jan 2018 00:25:48 +0000 (00:25 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Jan 2018 00:25:48 +0000 (00:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=181814

Patch by Basuke Suzuki <Basuke.Suzuki@sony.com> on 2018-01-18
Reviewed by Alex Christensen.

* Scripts/webkitpy/port/driver.py:
(Driver):
(Driver.http_test_path_to_uri):
(Driver.is_secure_path):
(Driver.http_base_url):
(Driver.uri_to_test):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227171 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/port/driver.py

index 015a425..acb0eb8 100644 (file)
@@ -1,3 +1,17 @@
+2018-01-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
+
+        [WinCairo] Pass correct url for http test to test driver.
+        https://bugs.webkit.org/show_bug.cgi?id=181814
+
+        Reviewed by Alex Christensen.
+
+        * Scripts/webkitpy/port/driver.py:
+        (Driver):
+        (Driver.http_test_path_to_uri):
+        (Driver.is_secure_path):
+        (Driver.http_base_url):
+        (Driver.uri_to_test):
+
 2018-01-18  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, update the triggerable name for 'sierra-release-perf-tests'
index 8d4c8d4..f1295ca 100644 (file)
@@ -35,6 +35,7 @@ import sys
 import time
 import os
 
+from os.path import normpath
 from webkitpy.common.system import path
 from webkitpy.common.system.profiler import ProfilerFactory
 
@@ -253,10 +254,10 @@ class Driver(object):
             return shlex.split(self._port.get_option('wrapper')) + wrapper_arguments
         return wrapper_arguments
 
-    HTTP_DIR = "http/tests/"
-    HTTP_LOCAL_DIR = "http/tests/local/"
-    WEBKIT_SPECIFIC_WEB_PLATFORM_TEST_SUBDIR = "http/wpt/"
-    WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE = "WebKit/"
+    HTTP_DIR = normpath("http/tests") + os.sep
+    HTTP_LOCAL_DIR = normpath("http/tests/local") + os.sep
+    WEBKIT_SPECIFIC_WEB_PLATFORM_TEST_SUBDIR = normpath("http/wpt") + os.sep
+    WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE = normpath("WebKit") + os.sep
 
     def is_http_test(self, test_name):
         return test_name.startswith(self.HTTP_DIR) and not test_name.startswith(self.HTTP_LOCAL_DIR)
@@ -271,7 +272,14 @@ class Driver(object):
         return self.web_platform_test_server_base_https_url + path if ".https." in path else self.web_platform_test_server_base_http_url + path
 
     def http_test_path_to_uri(self, path):
-        return "https://127.0.0.1:8443/" + path if path.startswith("ssl") or ".https." in path else "http://127.0.0.1:8000/" + path
+        path = path.replace(os.sep, '/')
+        return self.http_base_url(secure=self.is_secure_path(path)) + path
+
+    def is_secure_path(self, path):
+        return path.startswith("ssl") or ".https." in path
+
+    def http_base_url(self, secure=None):
+        return "%s://127.0.0.1:%d/" % (('https', 8443) if secure else ('http', 8000))
 
     def test_to_uri(self, test_name):
         """Convert a test name to a URI."""
@@ -307,9 +315,9 @@ class Driver(object):
         if uri.startswith(self.web_platform_test_server_base_https_url):
             return uri.replace(self.web_platform_test_server_base_https_url, self.web_platform_test_server_doc_root)
         if uri.startswith("http://"):
-            return uri.replace('http://127.0.0.1:8000/', self.HTTP_DIR)
+            return uri.replace(self.http_base_url(secure=False), self.HTTP_DIR)
         if uri.startswith("https://"):
-            return uri.replace('https://127.0.0.1:8443/', self.HTTP_DIR)
+            return uri.replace(self.http_base_url(secure=True), self.HTTP_DIR)
         raise NotImplementedError('unknown url type: %s' % uri)
 
     def has_crashed(self):