Changeset 125031 in webkit


Ignore:
Timestamp:
Aug 8, 2012 6:18:18 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> 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):

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r125030 r125031  
     12012-08-08  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
     2
     3        [WK2] [WTR] Provide Resource Response dumping.
     4        https://bugs.webkit.org/show_bug.cgi?id=93454
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Several new getter functions were added to WKURLResponse and WKURL, so that WTR has
     9        necessary data for dumping.
     10
     11        * Shared/API/c/WKURL.cpp:
     12        (WKURLCopyLastPathComponent):
     13        * Shared/API/c/WKURL.h:
     14        * Shared/API/c/WKURLResponse.cpp:
     15        (WKURLResponseCopyURL): Returns URL of the response.
     16        (WKURLResponseCopyMimeType): Returns MIME type of the response.
     17        * Shared/API/c/WKURLResponse.h:
     18        * Shared/WebURL.h:
     19        (WebKit::WebURL::lastPathComponent): Returns last path component of the URL.
     20        (WebURL):
     21
    1222012-08-08  Eunmi Lee  <eunmi15.lee@samsung.com>
    223
  • trunk/Source/WebKit2/Shared/API/c/WKURL.cpp

    r95901 r125031  
    6060    return toCopiedAPI(toImpl(url)->protocol());
    6161}
     62
     63WKStringRef WKURLCopyLastPathComponent(WKURLRef url)
     64{
     65    return toCopiedAPI(toImpl(url)->lastPathComponent());
     66}
  • trunk/Source/WebKit2/Shared/API/c/WKURL.h

    r95901 r125031  
    4040WK_EXPORT WKStringRef WKURLCopyHostName(WKURLRef url);
    4141WK_EXPORT WKStringRef WKURLCopyScheme(WKURLRef url);
     42WK_EXPORT WKStringRef WKURLCopyLastPathComponent(WKURLRef url);
    4243
    4344WK_EXPORT bool WKURLIsEqual(WKURLRef a, WKURLRef b);
  • trunk/Source/WebKit2/Shared/API/c/WKURLResponse.cpp

    r95901 r125031  
    2929#include "WKAPICast.h"
    3030#include "WebURLResponse.h"
     31#include <WebCore/KURL.h>
    3132
    3233using namespace WebKit;
     
    3738}
    3839
     40WKURLRef WKURLResponseCopyURL(WKURLResponseRef responseRef)
     41{
     42    return toCopiedURLAPI(toImpl(responseRef)->resourceResponse().url());
     43}
     44
     45WKStringRef WKURLResponseCopyMimeType(WKURLResponseRef responseRef)
     46{
     47    return toCopiedAPI(toImpl(responseRef)->resourceResponse().mimeType());
     48}
  • trunk/Source/WebKit2/Shared/API/c/WKURLResponse.h

    r95901 r125031  
    3535WK_EXPORT WKTypeID WKURLResponseGetTypeID();
    3636
     37WK_EXPORT WKURLRef WKURLResponseCopyURL(WKURLResponseRef);
     38
     39WK_EXPORT WKStringRef WKURLResponseCopyMimeType(WKURLResponseRef);
     40
    3741#ifdef __cplusplus
    3842}
  • trunk/Source/WebKit2/Shared/WebURL.h

    r95901 r125031  
    6464    }
    6565
     66    String lastPathComponent() const
     67    {
     68        parseURLIfNecessary();
     69        return m_parsedURL->isValid() ? m_parsedURL->lastPathComponent() : String();
     70    }
     71
    6672private:
    6773    WebURL(const String& string)
  • trunk/Tools/ChangeLog

    r125023 r125031  
     12012-08-08  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
     2
     3        [WK2] [WTR] Provide Resource Response dumping.
     4        https://bugs.webkit.org/show_bug.cgi?id=93454
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Added missing dumpResourceResponseMIMETypes() method to testRunner. Provided resource response dumping.
     9
     10        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
     11        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     12        (WTR::InjectedBundlePage::didReceiveResponseForResource):
     13        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
     14        (WTR::LayoutTestController::LayoutTestController):
     15        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
     16        (WTR::LayoutTestController::dumpProgressFinishedCallback):
     17        (WTR::LayoutTestController::dumpResourceResponseMIMETypes):
     18        (WTR::LayoutTestController::shouldDumpResourceResponseMIMETypes):
     19        (LayoutTestController):
     20
    1212012-08-08  Simon Hausmann  <simon.hausmann@nokia.com>
    222
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl

    r124477 r125031  
    4545        void dumpFrameLoadCallbacks();
    4646        void dumpProgressFinishedCallback();
     47        void dumpResourceResponseMIMETypes();
    4748
    4849        // Special options.
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r124770 r125031  
    991991}
    992992
    993 void InjectedBundlePage::didReceiveResponseForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t, WKURLResponseRef)
    994 {
     993void InjectedBundlePage::didReceiveResponseForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t, WKURLResponseRef response)
     994{
     995    if (!InjectedBundle::shared().isTestRunning())
     996        return;
     997
     998    if (!InjectedBundle::shared().layoutTestController()->shouldDumpResourceResponseMIMETypes())
     999        return;
     1000
     1001    WKRetainPtr<WKURLRef> url = adoptWK(WKURLResponseCopyURL(response));
     1002    WKRetainPtr<WKStringRef> urlString = adoptWK(WKURLCopyLastPathComponent(url.get()));
     1003    WKRetainPtr<WKStringRef> mimeTypeString = adoptWK(WKURLResponseCopyMimeType(response));
     1004
     1005    InjectedBundle::shared().stringBuilder()->append(toWTFString(urlString));
     1006    InjectedBundle::shared().stringBuilder()->append(" has MIME type ");
     1007    InjectedBundle::shared().stringBuilder()->append(toWTFString(mimeTypeString));
     1008    InjectedBundle::shared().stringBuilder()->append("\n");
    9951009}
    9961010
  • trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp

    r124705 r125031  
    7878    , m_dumpFrameLoadCallbacks(false)
    7979    , m_dumpProgressFinishedCallback(false)
     80    , m_dumpResourceResponseMIMETypes(false)
    8081    , m_waitToDump(false)
    8182    , m_testRepaint(false)
  • trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h

    r125019 r125031  
    7979    void dumpFullScreenCallbacks() { m_dumpFullScreenCallbacks = true; }
    8080    void dumpFrameLoadCallbacks() { setShouldDumpFrameLoadCallbacks(true); }
    81     void dumpProgressFinishedCallback() { setShouldDumpProgressFinishedCallback(true); }
     81    void dumpProgressFinishedCallback() { setShouldDumpProgressFinishedCallback(true); }   
     82    void dumpResourceResponseMIMETypes() { m_dumpResourceResponseMIMETypes = true; }
    8283
    8384    void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }
     
    163164    bool shouldDumpFrameLoadCallbacks() const { return m_dumpFrameLoadCallbacks; }
    164165    bool shouldDumpProgressFinishedCallback() const { return m_dumpProgressFinishedCallback; }
     166    bool shouldDumpResourceResponseMIMETypes() const { return m_dumpResourceResponseMIMETypes; }
     167
    165168    bool isPolicyDelegateEnabled() const { return m_policyDelegateEnabled; }
    166169    bool isPolicyDelegatePermissive() const { return m_policyDelegatePermissive; }
     
    247250    bool m_dumpFrameLoadCallbacks;
    248251    bool m_dumpProgressFinishedCallback;
     252    bool m_dumpResourceResponseMIMETypes;
    249253    bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
    250254    bool m_testRepaint;
Note: See TracChangeset for help on using the changeset viewer.