Title: [189390] trunk/Tools
Revision
189390
Author
[email protected]
Date
2015-09-04 14:53:00 -0700 (Fri, 04 Sep 2015)

Log Message

It should be possible to pass relative HTTP test paths to DumpRenderTree
https://bugs.webkit.org/show_bug.cgi?id=148825
<rdar://problem/22583866>

Reviewed by Tim Horton.

Convert the path to an absolute path if needed.

* DumpRenderTree/mac/DumpRenderTree.mm:
(computeTestURL):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (189389 => 189390)


--- trunk/Tools/ChangeLog	2015-09-04 21:28:28 UTC (rev 189389)
+++ trunk/Tools/ChangeLog	2015-09-04 21:53:00 UTC (rev 189390)
@@ -1,3 +1,16 @@
+2015-09-04  Anders Carlsson  <[email protected]>
+
+        It should be possible to pass relative HTTP test paths to DumpRenderTree
+        https://bugs.webkit.org/show_bug.cgi?id=148825
+        <rdar://problem/22583866>
+
+        Reviewed by Tim Horton.
+
+        Convert the path to an absolute path if needed.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (computeTestURL):
+
 2015-09-04  Jason Marcell  <[email protected]>
 
         Fix Swift unit tests for prepare-ChangeLog.

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (189389 => 189390)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2015-09-04 21:28:28 UTC (rev 189389)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2015-09-04 21:53:00 UTC (rev 189390)
@@ -1903,20 +1903,22 @@
     if ([pathOrURLString hasPrefix:@"http://"] || [pathOrURLString hasPrefix:@"https://"] || [pathOrURLString hasPrefix:@"file://"])
         return [NSURL URLWithString:pathOrURLString];
 
-    NSRange layoutTestsRange = [pathOrURLString rangeOfString:@"/LayoutTests/"];
+    NSString *absolutePath = [[[NSURL fileURLWithPath:pathOrURLString] absoluteURL] path];
+
+    NSRange layoutTestsRange = [absolutePath rangeOfString:@"/LayoutTests/"];
     if (layoutTestsRange.location == NSNotFound)
-        return [NSURL fileURLWithPath:pathOrURLString];
+        return [NSURL fileURLWithPath:absolutePath];
 
-    *relativeTestPath = [pathOrURLString substringFromIndex:NSMaxRange(layoutTestsRange)];
+    *relativeTestPath = [absolutePath 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];
+    NSRange httpTestsRange = [absolutePath rangeOfString:@"/LayoutTests/http/tests/"];
+    if (httpTestsRange.location == NSNotFound || [absolutePath rangeOfString:@"/LayoutTests/http/tests/local/"].location != NSNotFound)
+        return [NSURL fileURLWithPath:absolutePath];
 
     auto components = adoptNS([[NSURLComponents alloc] init]);
-    [components setPath:[pathOrURLString substringFromIndex:NSMaxRange(httpTestsRange) - 1]];
+    [components setPath:[absolutePath substringFromIndex:NSMaxRange(httpTestsRange) - 1]];
     [components setHost:@"127.0.0.1"];
 
     // Paths under /ssl/ should be loaded using HTTPS.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to