diff options
author | hamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-01 10:26:43 +0000 |
---|---|---|
committer | hamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-01 10:26:43 +0000 |
commit | b74f99609c717709d5ccbf3cf00f34e661ed8262 (patch) | |
tree | 7f432ed985e4ab36222dc9eba8e557c8bb97bb80 | |
parent | c9c502ebc946489fbe3b24b5fa8537022edaace1 (diff) | |
download | chromium_src-b74f99609c717709d5ccbf3cf00f34e661ed8262.zip chromium_src-b74f99609c717709d5ccbf3cf00f34e661ed8262.tar.gz chromium_src-b74f99609c717709d5ccbf3cf00f34e661ed8262.tar.bz2 |
Make dumpResourceLoadCallbacks() show relative paths which match the results of WebKit's expectation.
BUG=8407
TEST=none
Review URL: http://codereview.chromium.org/255024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27716 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | webkit/tools/layout_tests/test_expectations.txt | 5 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 30 |
2 files changed, 25 insertions, 10 deletions
diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt index 1ca63a4..6005608 100755 --- a/webkit/tools/layout_tests/test_expectations.txt +++ b/webkit/tools/layout_tests/test_expectations.txt @@ -1126,11 +1126,6 @@ BUG3273 MAC : LayoutTests/platform/mac/editing/input/range-for-empty-document.ht // Regression from the 41362:41402 merge. BUG8402 MAC : LayoutTests/fast/forms/drag-out-of-textarea.html = FAIL PASS -// This test fails because (in Chromium) it includes the full path to the -// subframe URL. Need to teach dumpResourceLoadCallbacks() about relative -// URLs. -BUG8407 : LayoutTests/fast/loader/main-document-url-for-non-http-loads.html = FAIL - // These tests are flaky as of 2009/06/09. Need to investigate. // <body><canvas height=100></canvas></body> is 1 px taller than upstream. diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index c7b1e27..75d6a58 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -122,6 +122,23 @@ std::string UrlSuitableForTestResult(const std::string& url) { return filename; } +// Used to write a platform neutral file:/// URL by taking the +// filename and its directory. (e.g., converts +// "file:///tmp/foo/bar.txt" to just "bar.txt"). +std::string DescriptionSuitableForTestResult(const std::string& url) { + if (url.empty() || std::string::npos == url.find("file://")) + return url; + + size_t pos = url.rfind('/'); + if (pos == std::string::npos || pos == 0) + return "ERROR:" + url; + pos = url.rfind('/', pos - 1); + if (pos == std::string::npos) + return "ERROR:" + url; + + return url.substr(pos + 1); +} + // Adds a file called "DRTFakeFile" to |data_object| (CF_HDROP). Use to fake // dragging a file. void AddDRTFakeFileToDataObject(WebDragData* drag_data) { @@ -158,9 +175,10 @@ std::string GetResponseDescription(const WebURLResponse& response) { if (response.isNull()) return "(null)"; + const std::string url = GURL(response.url()).possibly_invalid_spec(); return StringPrintf("<NSURLResponse %s, http status code %d>", - GURL(response.url()).possibly_invalid_spec().c_str(), - response.httpStatusCode()); + DescriptionSuitableForTestResult(url).c_str(), + response.httpStatusCode()); } std::string GetErrorDescription(const WebURLError& error) { @@ -801,8 +819,10 @@ void TestWebViewDelegate::didChangeLocationWithinPage( void TestWebViewDelegate::assignIdentifierToRequest( WebFrame* frame, unsigned identifier, const WebURLRequest& request) { - if (shell_->ShouldDumpResourceLoadCallbacks()) - resource_identifier_map_[identifier] = request.url().spec(); + if (shell_->ShouldDumpResourceLoadCallbacks()) { + resource_identifier_map_[identifier] = + DescriptionSuitableForTestResult(request.url().spec()); + } } void TestWebViewDelegate::willSendRequest( @@ -816,7 +836,7 @@ void TestWebViewDelegate::willSendRequest( printf("%s - willSendRequest <NSURLRequest URL %s, main document URL %s," " http method %s> redirectResponse %s\n", GetResourceDescription(identifier).c_str(), - request_url.c_str(), + DescriptionSuitableForTestResult(request_url).c_str(), GetURLDescription(main_document_url).c_str(), request.httpMethod().utf8().data(), GetResponseDescription(redirect_response).c_str()); |