Bug 97808 - Chromium: DRT should accept file path as an argument, not just url
Summary: Chromium: DRT should accept file path as an argument, not just url
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-27 11:55 PDT by Dominic Mazzoni
Modified: 2012-11-01 20:29 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominic Mazzoni 2012-09-27 11:55:20 PDT
In the Mac port of DRT, you can give it a path to a test, for example:
  WebKitBuild/Release/DumpRenderTree LayoutTests/accessibility/textarea-line-for-index.html

In the Chromium port, this doesn't work - you have to give it a file:// url:
  out/Release/DumpRenderTree file:///home/user/.../chrome/src/third_party/WebKit/LayoutTests/accessibility/textarea-line-for-index.html

If you do try to pass a file path to the Chromium port of DRT, you get the render tree for the "file not found" page, which isn't at all obvious.

Let's just make DRT in Chromium accept a file path as an argument and automatically convert it to a file:// url.
Comment 1 Eric Seidel (no email) 2012-10-30 15:52:23 PDT
This is a stupidly annoying bug.  Chromium is the odd-man out here.
Comment 2 Dirk Pranke 2012-10-30 15:55:54 PDT
+1.
Comment 3 Eric Seidel (no email) 2012-10-30 16:03:58 PDT
Mac uses NSURL to make this easy:

    NSURL *url;
    if ([pathOrURLString hasPrefix:@"http://"] || [pathOrURLString hasPrefix:@"https://"] || [pathOrURLString hasPrefix:@"file://"])
        url = [NSURL URLWithString:pathOrURLString];
    else
        url = [NSURL fileURLWithPath:pathOrURLString];
    if (!url) {
        fprintf(stderr, "Failed to parse \"%s\" as a URL\n", pathOrURL.c_str());
        return;
    }

It appears we have code to do this, it's just broken:
    params.testUrl = webkit_support::CreateURLForPathOrURL(command.pathOrURL);
Comment 4 Eric Seidel (no email) 2012-10-30 16:06:07 PDT
http://code.google.com/searchframe#OAMlx_jo-ck/src/webkit/support/webkit_support.cc&exact_package=chromium&q=CreateURLForPathOrURL&type=cs&l=629

Looks like tkent is the last to touch that function.  It's possible we're just using it wrong.
Comment 5 Tony Chang 2012-10-30 16:22:01 PDT
I think the problem is just with relative file names.  I pass in absolute paths all the time.
Comment 6 Kent Tamura 2012-11-01 00:04:58 PDT
I have posted a patch: https://codereview.chromium.org/11366024/
Comment 7 Eric Seidel (no email) 2012-11-01 01:10:04 PDT
Thank you.
Comment 8 Kent Tamura 2012-11-01 20:29:23 PDT
crrev.com/165593 should fix this.