When dumping a response's MIME type, print its URL's last path component rather than...
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Jul 2010 16:21:26 +0000 (16:21 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Jul 2010 16:21:26 +0000 (16:21 +0000)
This matches the Mac behavior.

Fixes <http://webkit.org/b/42276>
http/tests/loading/preload-slow-loading.php and
http/tests/mime/uppercase-mime-type.html fail on Windows

Reviewed by Anders Carlsson.

* DumpRenderTree/win/DumpRenderTree.cpp:
(urlSuitableForTestResult): Moved code to actually extract the last
path component from here...
(lastPathComponent): ...to here.

* DumpRenderTree/win/DumpRenderTreeWin.h: Added lastPathComponent.

* DumpRenderTree/win/ResourceLoadDelegate.cpp:
(ResourceLoadDelegate::didReceiveResponse): Use the URL's last path
component, rather than its suitable-for-test-result form, to match
Mac.

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

WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h
WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp

index 92ca433..e4156ed 100644 (file)
@@ -1,3 +1,28 @@
+2010-07-19  Adam Roben  <aroben@apple.com>
+
+        When dumping a response's MIME type, print its URL's last path
+        component rather than its suitable-for-test-result form
+
+        This matches the Mac behavior.
+
+        Fixes <http://webkit.org/b/42276>
+        http/tests/loading/preload-slow-loading.php and
+        http/tests/mime/uppercase-mime-type.html fail on Windows
+
+        Reviewed by Anders Carlsson.
+
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (urlSuitableForTestResult): Moved code to actually extract the last
+        path component from here...
+        (lastPathComponent): ...to here.
+
+        * DumpRenderTree/win/DumpRenderTreeWin.h: Added lastPathComponent.
+
+        * DumpRenderTree/win/ResourceLoadDelegate.cpp:
+        (ResourceLoadDelegate::didReceiveResponse): Use the URL's last path
+        component, rather than its suitable-for-test-result form, to match
+        Mac.
+
 2010-07-19  Anders carlsson  <andersca@apple.com>
 
         Reviewed by Adam Roben.
index acc0771..a1b72e1 100644 (file)
@@ -134,7 +134,15 @@ bool setAlwaysAcceptCookies(bool alwaysAcceptCookies)
 
 wstring urlSuitableForTestResult(const wstring& url)
 {
-    if (!url.c_str() || url.find(L"file://") == wstring::npos)
+    if (url.find(L"file://") == wstring::npos)
+        return url;
+
+    return lastPathComponent(url);
+}
+
+wstring lastPathComponent(const wstring& url)
+{
+    if (url.empty())
         return url;
 
     return PathFindFileNameW(url.c_str());
index cc4337b..e3497c9 100644 (file)
@@ -49,6 +49,7 @@ extern HWND webViewWindow;
 #include <wtf/Vector.h>
 
 std::wstring urlSuitableForTestResult(const std::wstring& url);
+std::wstring lastPathComponent(const std::wstring&);
 std::string toUTF8(BSTR);
 std::string toUTF8(const std::wstring&);
 IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow = 0);
index 49231bd..33ccd7f 100644 (file)
@@ -333,10 +333,10 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didReceiveResponse(
         if (FAILED(response->URL(&urlBSTR)))
             E_FAIL;
     
-        wstring url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR));
+        wstring url = wstringFromBSTR(urlBSTR);
         ::SysFreeString(urlBSTR);
 
-        printf("%S has MIME type %S\n", url.c_str(), mimeType.c_str());
+        printf("%S has MIME type %S\n", lastPathComponent(url).c_str(), mimeType.c_str());
     }
 
     return S_OK;