Title: [125031] trunk
Revision
125031
Author
[email protected]
Date
2012-08-08 06:18:18 -0700 (Wed, 08 Aug 2012)

Log Message

[WK2] [WTR] Provide Resource Response dumping.
https://bugs.webkit.org/show_bug.cgi?id=93454

Patch by Mikhail Pozdnyakov <[email protected]> on 2012-08-08
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Several new getter functions were added to WKURLResponse and WKURL, so that WTR has
necessary data for dumping.

* Shared/API/c/WKURL.cpp:
(WKURLCopyLastPathComponent):
* Shared/API/c/WKURL.h:
* Shared/API/c/WKURLResponse.cpp:
(WKURLResponseCopyURL): Returns URL of the response.
(WKURLResponseCopyMimeType): Returns MIME type of the response.
* Shared/API/c/WKURLResponse.h:
* Shared/WebURL.h:
(WebKit::WebURL::lastPathComponent): Returns last path component of the URL.
(WebURL):

Tools:

Added missing dumpResourceResponseMIMETypes() method to testRunner. Provided resource response dumping.

* WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::didReceiveResponseForResource):
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::LayoutTestController):
* WebKitTestRunner/InjectedBundle/LayoutTestController.h:
(WTR::LayoutTestController::dumpProgressFinishedCallback):
(WTR::LayoutTestController::dumpResourceResponseMIMETypes):
(WTR::LayoutTestController::shouldDumpResourceResponseMIMETypes):
(LayoutTestController):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (125030 => 125031)


--- trunk/Source/WebKit2/ChangeLog	2012-08-08 13:15:59 UTC (rev 125030)
+++ trunk/Source/WebKit2/ChangeLog	2012-08-08 13:18:18 UTC (rev 125031)
@@ -1,3 +1,24 @@
+2012-08-08  Mikhail Pozdnyakov  <[email protected]>
+
+        [WK2] [WTR] Provide Resource Response dumping.
+        https://bugs.webkit.org/show_bug.cgi?id=93454
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Several new getter functions were added to WKURLResponse and WKURL, so that WTR has
+        necessary data for dumping.
+
+        * Shared/API/c/WKURL.cpp:
+        (WKURLCopyLastPathComponent):
+        * Shared/API/c/WKURL.h:
+        * Shared/API/c/WKURLResponse.cpp:
+        (WKURLResponseCopyURL): Returns URL of the response.
+        (WKURLResponseCopyMimeType): Returns MIME type of the response. 
+        * Shared/API/c/WKURLResponse.h:
+        * Shared/WebURL.h:
+        (WebKit::WebURL::lastPathComponent): Returns last path component of the URL.
+        (WebURL):
+
 2012-08-08  Eunmi Lee  <[email protected]>
 
         [EFL][WK2] Make ewk_view inheritable in the WebKit2.

Modified: trunk/Source/WebKit2/Shared/API/c/WKURL.cpp (125030 => 125031)


--- trunk/Source/WebKit2/Shared/API/c/WKURL.cpp	2012-08-08 13:15:59 UTC (rev 125030)
+++ trunk/Source/WebKit2/Shared/API/c/WKURL.cpp	2012-08-08 13:18:18 UTC (rev 125031)
@@ -59,3 +59,8 @@
 {
     return toCopiedAPI(toImpl(url)->protocol());
 }
+
+WKStringRef WKURLCopyLastPathComponent(WKURLRef url)
+{
+    return toCopiedAPI(toImpl(url)->lastPathComponent());
+}

Modified: trunk/Source/WebKit2/Shared/API/c/WKURL.h (125030 => 125031)


--- trunk/Source/WebKit2/Shared/API/c/WKURL.h	2012-08-08 13:15:59 UTC (rev 125030)
+++ trunk/Source/WebKit2/Shared/API/c/WKURL.h	2012-08-08 13:18:18 UTC (rev 125031)
@@ -39,6 +39,7 @@
 WK_EXPORT WKStringRef WKURLCopyString(WKURLRef url);
 WK_EXPORT WKStringRef WKURLCopyHostName(WKURLRef url);
 WK_EXPORT WKStringRef WKURLCopyScheme(WKURLRef url);
+WK_EXPORT WKStringRef WKURLCopyLastPathComponent(WKURLRef url);
 
 WK_EXPORT bool WKURLIsEqual(WKURLRef a, WKURLRef b);
 

Modified: trunk/Source/WebKit2/Shared/API/c/WKURLResponse.cpp (125030 => 125031)


--- trunk/Source/WebKit2/Shared/API/c/WKURLResponse.cpp	2012-08-08 13:15:59 UTC (rev 125030)
+++ trunk/Source/WebKit2/Shared/API/c/WKURLResponse.cpp	2012-08-08 13:18:18 UTC (rev 125031)
@@ -28,6 +28,7 @@
 
 #include "WKAPICast.h"
 #include "WebURLResponse.h"
+#include <WebCore/KURL.h>
 
 using namespace WebKit;
 
@@ -36,3 +37,12 @@
     return toAPI(WebURLResponse::APIType);
 }
 
+WKURLRef WKURLResponseCopyURL(WKURLResponseRef responseRef)
+{
+    return toCopiedURLAPI(toImpl(responseRef)->resourceResponse().url());
+}
+
+WKStringRef WKURLResponseCopyMimeType(WKURLResponseRef responseRef)
+{
+    return toCopiedAPI(toImpl(responseRef)->resourceResponse().mimeType());
+}

Modified: trunk/Source/WebKit2/Shared/API/c/WKURLResponse.h (125030 => 125031)


--- trunk/Source/WebKit2/Shared/API/c/WKURLResponse.h	2012-08-08 13:15:59 UTC (rev 125030)
+++ trunk/Source/WebKit2/Shared/API/c/WKURLResponse.h	2012-08-08 13:18:18 UTC (rev 125031)
@@ -34,6 +34,10 @@
 
 WK_EXPORT WKTypeID WKURLResponseGetTypeID();
 
+WK_EXPORT WKURLRef WKURLResponseCopyURL(WKURLResponseRef);
+
+WK_EXPORT WKStringRef WKURLResponseCopyMimeType(WKURLResponseRef);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/Shared/WebURL.h (125030 => 125031)


--- trunk/Source/WebKit2/Shared/WebURL.h	2012-08-08 13:15:59 UTC (rev 125030)
+++ trunk/Source/WebKit2/Shared/WebURL.h	2012-08-08 13:18:18 UTC (rev 125031)
@@ -63,6 +63,12 @@
         return m_parsedURL->isValid() ? m_parsedURL->protocol() : String();
     }
 
+    String lastPathComponent() const
+    {
+        parseURLIfNecessary();
+        return m_parsedURL->isValid() ? m_parsedURL->lastPathComponent() : String();
+    }
+
 private:
     WebURL(const String& string)
         : m_string(string)

Modified: trunk/Tools/ChangeLog (125030 => 125031)


--- trunk/Tools/ChangeLog	2012-08-08 13:15:59 UTC (rev 125030)
+++ trunk/Tools/ChangeLog	2012-08-08 13:18:18 UTC (rev 125031)
@@ -1,3 +1,23 @@
+2012-08-08  Mikhail Pozdnyakov  <[email protected]>
+
+        [WK2] [WTR] Provide Resource Response dumping.
+        https://bugs.webkit.org/show_bug.cgi?id=93454
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Added missing dumpResourceResponseMIMETypes() method to testRunner. Provided resource response dumping.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::didReceiveResponseForResource):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        (WTR::LayoutTestController::LayoutTestController):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
+        (WTR::LayoutTestController::dumpProgressFinishedCallback):
+        (WTR::LayoutTestController::dumpResourceResponseMIMETypes):
+        (WTR::LayoutTestController::shouldDumpResourceResponseMIMETypes):
+        (LayoutTestController):
+
 2012-08-08  Simon Hausmann  <[email protected]>
 
         [Qt][Win] Fix compilation of DumpRenderTree

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl (125030 => 125031)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl	2012-08-08 13:15:59 UTC (rev 125030)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl	2012-08-08 13:18:18 UTC (rev 125031)
@@ -44,6 +44,7 @@
         void dumpFullScreenCallbacks();
         void dumpFrameLoadCallbacks();
         void dumpProgressFinishedCallback();
+        void dumpResourceResponseMIMETypes();
 
         // Special options.
         void keepWebHistory();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (125030 => 125031)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-08-08 13:15:59 UTC (rev 125030)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-08-08 13:18:18 UTC (rev 125031)
@@ -990,8 +990,22 @@
     return request;
 }
 
-void InjectedBundlePage::didReceiveResponseForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t, WKURLResponseRef)
+void InjectedBundlePage::didReceiveResponseForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t, WKURLResponseRef response)
 {
+    if (!InjectedBundle::shared().isTestRunning())
+        return;
+
+    if (!InjectedBundle::shared().layoutTestController()->shouldDumpResourceResponseMIMETypes())
+        return;
+
+    WKRetainPtr<WKURLRef> url = ""
+    WKRetainPtr<WKStringRef> urlString = adoptWK(WKURLCopyLastPathComponent(url.get()));
+    WKRetainPtr<WKStringRef> mimeTypeString = adoptWK(WKURLResponseCopyMimeType(response));
+
+    InjectedBundle::shared().stringBuilder()->append(toWTFString(urlString));
+    InjectedBundle::shared().stringBuilder()->append(" has MIME type ");
+    InjectedBundle::shared().stringBuilder()->append(toWTFString(mimeTypeString));
+    InjectedBundle::shared().stringBuilder()->append("\n");
 }
 
 void InjectedBundlePage::didReceiveContentLengthForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t, uint64_t)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp (125030 => 125031)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp	2012-08-08 13:15:59 UTC (rev 125030)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp	2012-08-08 13:18:18 UTC (rev 125031)
@@ -77,6 +77,7 @@
     , m_dumpFullScreenCallbacks(false)
     , m_dumpFrameLoadCallbacks(false)
     , m_dumpProgressFinishedCallback(false)
+    , m_dumpResourceResponseMIMETypes(false)
     , m_waitToDump(false)
     , m_testRepaint(false)
     , m_testRepaintSweepHorizontally(false)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h (125030 => 125031)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h	2012-08-08 13:15:59 UTC (rev 125030)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h	2012-08-08 13:18:18 UTC (rev 125031)
@@ -78,7 +78,8 @@
     void dumpTitleChanges() { m_dumpTitleChanges = true; }
     void dumpFullScreenCallbacks() { m_dumpFullScreenCallbacks = true; }
     void dumpFrameLoadCallbacks() { setShouldDumpFrameLoadCallbacks(true); }
-    void dumpProgressFinishedCallback() { setShouldDumpProgressFinishedCallback(true); }
+    void dumpProgressFinishedCallback() { setShouldDumpProgressFinishedCallback(true); }    
+    void dumpResourceResponseMIMETypes() { m_dumpResourceResponseMIMETypes = true; }
 
     void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }
     void setShouldDumpProgressFinishedCallback(bool value) { m_dumpProgressFinishedCallback = value; }
@@ -162,6 +163,8 @@
     bool shouldDumpFullScreenCallbacks() const { return m_dumpFullScreenCallbacks; }
     bool shouldDumpFrameLoadCallbacks() const { return m_dumpFrameLoadCallbacks; }
     bool shouldDumpProgressFinishedCallback() const { return m_dumpProgressFinishedCallback; }
+    bool shouldDumpResourceResponseMIMETypes() const { return m_dumpResourceResponseMIMETypes; }
+
     bool isPolicyDelegateEnabled() const { return m_policyDelegateEnabled; }
     bool isPolicyDelegatePermissive() const { return m_policyDelegatePermissive; }
 
@@ -246,6 +249,7 @@
     bool m_dumpFullScreenCallbacks;
     bool m_dumpFrameLoadCallbacks;
     bool m_dumpProgressFinishedCallback;
+    bool m_dumpResourceResponseMIMETypes;
     bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
     bool m_testRepaint;
     bool m_testRepaintSweepHorizontally;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to