Title: [189311] trunk/Tools
Revision
189311
Author
[email protected]
Date
2015-09-03 16:30:08 -0700 (Thu, 03 Sep 2015)

Log Message

DumpRenderTree should automatically compute HTTP URLs for HTTP tests
https://bugs.webkit.org/show_bug.cgi?id=148746
rdar://problem/22568073

Reviewed by Tim Horton.

* DumpRenderTree/mac/DumpRenderTree.mm:
(computeTestURL):
Compute the test URL from the passed in path or URL. Special-case paths that contain /LayoutTests/http/tests.

(runTest):
Call computeTestURL.

(testPathFromURL):
Get rid of this; computeTestURL does this for us now.

* Scripts/webkitpy/port/driver.py:
(Driver._command_from_driver_input):
Don't convert HTTP test paths to URLS before passing them to DumpRenderTree on Mac. That's handled by DRT itself now.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (189310 => 189311)


--- trunk/Tools/ChangeLog	2015-09-03 23:23:44 UTC (rev 189310)
+++ trunk/Tools/ChangeLog	2015-09-03 23:30:08 UTC (rev 189311)
@@ -1,3 +1,25 @@
+2015-09-03  Anders Carlsson  <[email protected]>
+
+        DumpRenderTree should automatically compute HTTP URLs for HTTP tests
+        https://bugs.webkit.org/show_bug.cgi?id=148746
+        rdar://problem/22568073
+
+        Reviewed by Tim Horton.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (computeTestURL):
+        Compute the test URL from the passed in path or URL. Special-case paths that contain /LayoutTests/http/tests. 
+
+        (runTest):
+        Call computeTestURL.
+
+        (testPathFromURL):
+        Get rid of this; computeTestURL does this for us now.
+
+        * Scripts/webkitpy/port/driver.py:
+        (Driver._command_from_driver_input):
+        Don't convert HTTP test paths to URLS before passing them to DumpRenderTree on Mac. That's handled by DRT itself now.
+
 2015-09-03  Tim Horton  <[email protected]>
 
         Swipe tests fail on Mavericks

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (189310 => 189311)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2015-09-03 23:23:44 UTC (rev 189310)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2015-09-03 23:30:08 UTC (rev 189311)
@@ -1896,25 +1896,40 @@
 }
 #endif
 
-static NSString *testPathFromURL(NSURL* url)
+static NSURL *computeTestURL(NSString *pathOrURLString, NSString **relativeTestPath)
 {
-    if ([url isFileURL]) {
-        NSString *filePath = [url path];
-        NSRange layoutTestsRange = [filePath rangeOfString:@"/LayoutTests/"];
-        if (layoutTestsRange.location == NSNotFound)
-            return nil;
+    *relativeTestPath = nil;
 
-        return [filePath substringFromIndex:NSMaxRange(layoutTestsRange)];
+    if ([pathOrURLString hasPrefix:@"http://"] || [pathOrURLString hasPrefix:@"https://"] || [pathOrURLString hasPrefix:@"file://"])
+        return [NSURL URLWithString:pathOrURLString];
+
+    NSRange layoutTestsRange = [pathOrURLString rangeOfString:@"/LayoutTests/"];
+    if (layoutTestsRange.location == NSNotFound)
+        return [NSURL fileURLWithPath:pathOrURLString];
+
+    *relativeTestPath = [pathOrURLString substringFromIndex:NSMaxRange(layoutTestsRange)];
+
+    // Convert file URLs in LayoutTests/http/tests to HTTP URLs, except for file URLs in LayoutTests/http/tests/local.
+
+    NSRange httpTestsRange = [pathOrURLString rangeOfString:@"/LayoutTests/http/tests/"];
+    if (httpTestsRange.location == NSNotFound || [pathOrURLString rangeOfString:@"/LayoutTests/http/tests/local/"].location != NSNotFound)
+        return [NSURL fileURLWithPath:pathOrURLString];
+
+    auto components = adoptNS([[NSURLComponents alloc] init]);
+    [components setPath:[pathOrURLString substringFromIndex:NSMaxRange(httpTestsRange) - 1]];
+    [components setHost:@"127.0.0.1"];
+
+    // Paths under /ssl/ should be loaded using HTTPS.
+    BOOL isSecure = [[components path] hasPrefix:@"/ssl/"];
+    if (isSecure) {
+        [components setScheme:@"https"];
+        [components setPort:@(8443)];
+    } else {
+        [components setScheme:@"http"];
+        [components setPort:@(8000)];
     }
-    
-    // HTTP test URLs look like: http://127.0.0.1:8000/inspector/resource-tree/resource-request-content-after-loading-and-clearing-cache.html
-    if (![[url scheme] isEqualToString:@"http"] && ![[url scheme] isEqualToString:@"https"])
-        return nil;
 
-    if ([[url host] isEqualToString:@"127.0.0.1"] && ([[url port] intValue] == 8000 || [[url port] intValue] == 8443))
-        return [url path];
-
-    return nil;
+    return [components URL];
 }
 
 static void runTest(const string& inputLine)
@@ -1931,19 +1946,15 @@
         return;
     }
 
-    NSURL *url;
-    if ([pathOrURLString hasPrefix:@"http://"] || [pathOrURLString hasPrefix:@"https://"] || [pathOrURLString hasPrefix:@"file://"])
-        url = "" URLWithString:pathOrURLString];
-    else
-        url = "" fileURLWithPath:pathOrURLString];
+    NSString *testPath;
+    NSURL *url = "" &testPath);
     if (!url) {
         fprintf(stderr, "Failed to parse \"%s\" as a URL\n", pathOrURL.c_str());
         return;
     }
-
-    NSString *testPath = testPathFromURL(url);
     if (!testPath)
         testPath = [url absoluteString];
+
     NSString *informationString = [@"CRASHING TEST: " stringByAppendingString:testPath];
     WKSetCrashReportApplicationSpecificInformation((CFStringRef)informationString);
 

Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (189310 => 189311)


--- trunk/Tools/Scripts/webkitpy/port/driver.py	2015-09-03 23:23:44 UTC (rev 189310)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py	2015-09-03 23:30:08 UTC (rev 189311)
@@ -422,7 +422,7 @@
         # FIXME: performance tests pass in full URLs instead of test names.
         if driver_input.test_name.startswith('http://') or driver_input.test_name.startswith('https://')  or driver_input.test_name == ('about:blank'):
             command = driver_input.test_name
-        elif self.is_http_test(driver_input.test_name) or self.is_web_platform_test(driver_input.test_name):
+        elif self.is_web_platform_test(driver_input.test_name) or (self.is_http_test(driver_input.test_name) and (self._port.get_option('webkit_test_runner') or sys.platform == "cygwin")):
             command = self.test_to_uri(driver_input.test_name)
         else:
             command = self._port.abspath_for_test(driver_input.test_name)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to