Changeset 136940 in webkit


Ignore:
Timestamp:
Dec 7, 2012, 2:22:06 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] DRT - Update implementation of TestRunner.setCustomPolicyDelegate()
https://bugs.webkit.org/show_bug.cgi?id=104243

RIM PR 259337

Patch by Xiaobo Wang <xbwang@torchmobile.com.cn> on 2012-12-07
Reviewed by Rob Buis.

Source/WebKit/blackberry:

  1. Add DRT callback in dispatchDecidePolicyForResponse.
  2. Pass frame pointer to DRT callback in

dispatchDecidePolicyForNavigationAction, so that it can be used to
calculate originating.

  1. Fix some webkit style errors.

The patch fixed the following tests:

  • http/tests/download
  • fast/forms/mailto/formenctype-attribute-button-html.html
  • fast/forms/mailto/formenctype-attribute-input-html.html
  • fast/encoding/mailto-always-utf-8.html
  • Api/DumpRenderTreeClient.h:
  • WebCoreSupport/FrameLoaderClientBlackBerry.cpp:

(WebCore::FrameLoaderClientBlackBerry::dispatchDecidePolicyForResponse):
(WebCore::FrameLoaderClientBlackBerry::dispatchDecidePolicyForNavigationAction):
(WebCore::FrameLoaderClientBlackBerry::transitionToCommittedForNewPage):
(WebCore::FrameLoaderClientBlackBerry::dispatchDidFinishLoad):
(WebCore::FrameLoaderClientBlackBerry::dispatchDidFailProvisionalLoad):
(WebCore::FrameLoaderClientBlackBerry::dispatchWillSendRequest):
(WebCore::FrameLoaderClientBlackBerry::decidePolicyForExternalLoad):

Tools:

  1. Implement calculation of navigation originating in

didDecidePolicyForNavigationAction().

  1. Implement policy delegate for resource response.
  2. Enable customPolicyDelegate if waitForPolicyDelegate() is called.
  3. Minor optional updates in dump() and dumpFrameLoadCallbacks().

The patch fixed the following tests:

  • http/tests/download
  • fast/forms/mailto/formenctype-attribute-button-html.html
  • fast/forms/mailto/formenctype-attribute-input-html.html
  • fast/encoding/mailto-always-utf-8.html
  • DumpRenderTree/blackberry/DumpRenderTree.cpp:

(BlackBerry::WebKit::DumpRenderTree::DumpRenderTree):
(BlackBerry::WebKit::DumpRenderTree::resetToConsistentStateBeforeTesting):
(BlackBerry::WebKit::DumpRenderTree::dump):
(BlackBerry::WebKit::DumpRenderTree::didFinishLoadForFrame):
(BlackBerry::WebKit::DumpRenderTree::didDecidePolicyForNavigationAction):
(BlackBerry::WebKit::DumpRenderTree::didDecidePolicyForResponse):
(BlackBerry::WebKit::DumpRenderTree::setCustomPolicyDelegate):

  • DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h:

(DumpRenderTree):

  • DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp:

(TestRunner::setCustomPolicyDelegate):
(TestRunner::waitForPolicyDelegate):
(TestRunner::overridePreference):

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h

    r127757 r136940  
    5656    virtual void didClearWindowObjectInWorld(WebCore::DOMWrapperWorld*, JSGlobalContextRef, JSObjectRef windowObject) = 0;
    5757    virtual void didReceiveTitleForFrame(const String& title, WebCore::Frame*) = 0;
    58     virtual void didDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&) = 0;
     58    virtual void didDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WebCore::Frame*) = 0;
     59    virtual void didDecidePolicyForResponse(const WebCore::ResourceResponse&) = 0;
    5960    virtual void didDispatchWillPerformClientRedirect() = 0;
    6061    virtual void didHandleOnloadEventsForFrame(WebCore::Frame*) = 0;
    6162
    6263    // ChromeClient delegates
    63     virtual void addMessageToConsole(const String& message, unsigned int lineNumber, const String& sourceID) = 0;
     64    virtual void addMessageToConsole(const String& message, unsigned lineNumber, const String& sourceID) = 0;
    6465    virtual void runJavaScriptAlert(const String& message) = 0;
    6566    virtual bool runJavaScriptConfirm(const String& message) = 0;
  • trunk/Source/WebKit/blackberry/ChangeLog

    r136930 r136940  
     12012-12-07  Xiaobo Wang  <xbwang@torchmobile.com.cn>
     2
     3        [BlackBerry] DRT - Update implementation of TestRunner.setCustomPolicyDelegate()
     4        https://bugs.webkit.org/show_bug.cgi?id=104243
     5
     6        RIM PR 259337
     7
     8        Reviewed by Rob Buis.
     9
     10        1. Add DRT callback in dispatchDecidePolicyForResponse.
     11        2. Pass frame pointer to DRT callback in
     12        dispatchDecidePolicyForNavigationAction, so that it can be used to
     13        calculate originating.
     14        3. Fix some webkit style errors.
     15
     16        The patch fixed the following tests:
     17        - http/tests/download
     18        - fast/forms/mailto/formenctype-attribute-button-html.html
     19        - fast/forms/mailto/formenctype-attribute-input-html.html
     20        - fast/encoding/mailto-always-utf-8.html
     21
     22        * Api/DumpRenderTreeClient.h:
     23        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
     24        (WebCore::FrameLoaderClientBlackBerry::dispatchDecidePolicyForResponse):
     25        (WebCore::FrameLoaderClientBlackBerry::dispatchDecidePolicyForNavigationAction):
     26        (WebCore::FrameLoaderClientBlackBerry::transitionToCommittedForNewPage):
     27        (WebCore::FrameLoaderClientBlackBerry::dispatchDidFinishLoad):
     28        (WebCore::FrameLoaderClientBlackBerry::dispatchDidFailProvisionalLoad):
     29        (WebCore::FrameLoaderClientBlackBerry::dispatchWillSendRequest):
     30        (WebCore::FrameLoaderClientBlackBerry::decidePolicyForExternalLoad):
     31
    1322012-12-07  Mary Wu  <mary.wu@torchmobile.com.cn>
    233
  • trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp

    r136930 r136940  
    201201        policy = PolicyDownload;
    202202
     203    if (m_webPagePrivate->m_dumpRenderTree)
     204        m_webPagePrivate->m_dumpRenderTree->didDecidePolicyForResponse(response);
     205
    203206    (m_frame->loader()->policyChecker()->*function)(policy);
    204207}
     
    244247        dispatchDidCancelClientRedirect();
    245248
     249    if (m_webPagePrivate->m_dumpRenderTree)
     250        m_webPagePrivate->m_dumpRenderTree->didDecidePolicyForNavigationAction(action, request, m_frame);
     251
    246252    (m_frame->loader()->policyChecker()->*function)(decision);
    247 
    248     if (m_webPagePrivate->m_dumpRenderTree)
    249         m_webPagePrivate->m_dumpRenderTree->didDecidePolicyForNavigationAction(action, request);
    250253}
    251254
     
    448451
    449452    m_frame->createView(m_webPagePrivate->viewportSize(),      /* viewport */
    450                         backgroundColor,                       /* background color */
    451                         backgroundColor.hasAlpha(),            /* is transparent */
    452                         m_webPagePrivate->actualVisibleSize(), /* fixed reported size */
    453                         m_webPagePrivate->fixedLayoutSize(),   /* fixed layout size */
    454                         IntRect(),                             /* fixed visible content rect */
    455                         m_webPagePrivate->useFixedLayout(),    /* use fixed layout */
    456                         ScrollbarAlwaysOff,                    /* hor mode */
    457                         true,                                  /* lock the mode */
    458                         ScrollbarAlwaysOff,                    /* ver mode */
    459                         true);                                 /* lock the mode */
     453        backgroundColor,                       /* background color */
     454        backgroundColor.hasAlpha(),            /* is transparent */
     455        m_webPagePrivate->actualVisibleSize(), /* fixed reported size */
     456        m_webPagePrivate->fixedLayoutSize(),   /* fixed layout size */
     457        IntRect(),                             /* fixed visible content rect */
     458        m_webPagePrivate->useFixedLayout(),    /* use fixed layout */
     459        ScrollbarAlwaysOff,                    /* hor mode */
     460        true,                                  /* lock the mode */
     461        ScrollbarAlwaysOff,                    /* ver mode */
     462        true);                                 /* lock the mode */
    460463
    461464    if (isMainFrame() && m_webPagePrivate->backingStoreClient()) {
     
    602605    // Process document metadata.
    603606    RefPtr<NodeList> nodeList = headElement->getElementsByTagName(HTMLNames::metaTag.localName());
    604     unsigned int size = nodeList->length();
     607    unsigned size = nodeList->length();
    605608    ScopeArray<BlackBerry::Platform::String> headers;
    606609
     
    698701
    699702        if (error.domain() == ResourceError::platformErrorDomain
    700                 && (error.errorCode() == BlackBerry::Platform::FilterStream::StatusErrorAlreadyHandled)) {
     703            && (error.errorCode() == BlackBerry::Platform::FilterStream::StatusErrorAlreadyHandled)) {
    701704            // Error has already been displayed by client.
    702705            return;
     
    980983}
    981984
    982 void FrameLoaderClientBlackBerry::dispatchWillSendRequest(DocumentLoader* docLoader, long unsigned int, ResourceRequest& request, const ResourceResponse&)
     985void FrameLoaderClientBlackBerry::dispatchWillSendRequest(DocumentLoader* docLoader, long unsigned, ResourceRequest& request, const ResourceResponse&)
    983986{
    984987    // If the request is being loaded by the provisional document loader, then
     
    11541157
    11551158    if (m_webPagePrivate->m_webSettings->areLinksHandledExternally()
    1156             && isMainFrame()
    1157             && !request.mustHandleInternally()
    1158             && !isFragmentScroll) {
     1159        && isMainFrame()
     1160        && !request.mustHandleInternally()
     1161        && !isFragmentScroll) {
    11591162        NetworkRequest platformRequest;
    11601163        request.initializePlatformRequest(platformRequest, cookiesEnabled());
  • trunk/Tools/ChangeLog

    r136934 r136940  
     12012-12-07  Xiaobo Wang  <xbwang@torchmobile.com.cn>
     2
     3        [BlackBerry] DRT - Update implementation of TestRunner.setCustomPolicyDelegate()
     4        https://bugs.webkit.org/show_bug.cgi?id=104243
     5
     6        RIM PR 259337
     7
     8        Reviewed by Rob Buis.
     9
     10        1. Implement calculation of navigation originating in
     11        didDecidePolicyForNavigationAction().
     12        2. Implement policy delegate for resource response.
     13        3. Enable customPolicyDelegate if waitForPolicyDelegate() is called.
     14        4. Minor optional updates in dump() and dumpFrameLoadCallbacks().
     15
     16        The patch fixed the following tests:
     17        - http/tests/download
     18        - fast/forms/mailto/formenctype-attribute-button-html.html
     19        - fast/forms/mailto/formenctype-attribute-input-html.html
     20        - fast/encoding/mailto-always-utf-8.html
     21
     22        * DumpRenderTree/blackberry/DumpRenderTree.cpp:
     23        (BlackBerry::WebKit::DumpRenderTree::DumpRenderTree):
     24        (BlackBerry::WebKit::DumpRenderTree::resetToConsistentStateBeforeTesting):
     25        (BlackBerry::WebKit::DumpRenderTree::dump):
     26        (BlackBerry::WebKit::DumpRenderTree::didFinishLoadForFrame):
     27        (BlackBerry::WebKit::DumpRenderTree::didDecidePolicyForNavigationAction):
     28        (BlackBerry::WebKit::DumpRenderTree::didDecidePolicyForResponse):
     29        (BlackBerry::WebKit::DumpRenderTree::setCustomPolicyDelegate):
     30        * DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h:
     31        (DumpRenderTree):
     32        * DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp:
     33        (TestRunner::setCustomPolicyDelegate):
     34        (TestRunner::waitForPolicyDelegate):
     35        (TestRunner::overridePreference):
     36
    1372012-12-07  Gwang Yoon Hwang  <ryumiel@company100.net>
    238
  • trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp

    r136628 r136940  
    3838#include "FrameTree.h"
    3939#include "FrameView.h"
     40#include "HTTPParsers.h"
    4041#include "HistoryItem.h"
     42#include "HitTestResult.h"
    4143#include "IntSize.h"
    4244#include "JSDOMBinding.h"
     45#include "MouseEvent.h"
     46#include "Node.h"
    4347#include "NotImplemented.h"
    4448#include "Page.h"
     
    164168    , m_workTimer(this, &DumpRenderTree::processWork)
    165169    , m_acceptsEditing(true)
     170    , m_policyDelegateEnabled(false)
    166171{
    167172    const char* workerNumber = getenv("WORKER_NUMBER") ? getenv("WORKER_NUMBER") : "0";
     
    272277    m_loadFinished = false;
    273278    s_selectTrailingWhitespaceEnabled = false;
    274 
     279    m_policyDelegateEnabled = false;
     280    waitForPolicy = false;
    275281    testDone = false;
    276282    WorkQueue::shared()->clear();
     
    524530
    525531    if (!runFromCommandLine) {
    526         // signal end of text block
    527         fputs("#EOF\n", stdout);
    528 
    529532        // There are two scenarios for dumping pixels:
    530533        // 1. When the test case explicitly asks for it by calling dumpAsText(true) with that extra true passed as a parameter value, from JavaScript
     
    535538        // But only if m_enablePixelTests is set, to say that the user wants to run pixel tests at all.
    536539        bool generatePixelResults = m_enablePixelTests && (explicitPixelResults || implicitPixelResults);
    537         if (generatePixelResults)
     540        if (generatePixelResults) {
     541            // signal end of text block
     542            fputs("#EOF\n", stdout);
    538543            dumpWebViewAsPixelsAndCompareWithExpected(gTestRunner->expectedPixelHash());
     544        }
    539545
    540546        String crashFile = dumpFile + ".crash";
     
    631637        printf("%s - didFinishLoadForFrame\n", drtFrameDescription(frame).utf8().data());
    632638
    633     if (frame == topLoadingFrame)
     639    if (frame == topLoadingFrame) {
    634640        m_loadFinished = true;
    635     locationChangeForFrame(frame);
     641        locationChangeForFrame(frame);
     642    }
    636643}
    637644
     
    832839}
    833840
    834 void DumpRenderTree::didDecidePolicyForNavigationAction(const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request)
    835 {
    836     if (!waitForPolicy)
     841void DumpRenderTree::didDecidePolicyForNavigationAction(const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, WebCore::Frame* frame)
     842{
     843    if (testDone || !m_policyDelegateEnabled)
    837844        return;
    838845
     
    861868    }
    862869
    863     printf("Policy delegate: attempt to load %s with navigation type '%s'\n", request.url().string().utf8().data(), typeDescription);
    864     // FIXME: do originating part.
    865 
    866     gTestRunner->notifyDone();
     870    bool shouldWaitForResponse = !request.url().string().startsWith("mailto:");
     871    printf("Policy delegate: attempt to load %s with navigation type '%s'", request.url().string().utf8().data(), typeDescription);
     872    // Originating part, borrowed from Chromium.
     873    RefPtr<WebCore::Node> node;
     874    for (const WebCore::Event* event = action.event(); event; event = event->underlyingEvent()) {
     875        if (event->isMouseEvent()) {
     876            const WebCore::MouseEvent* mouseEvent = static_cast<const WebCore::MouseEvent*>(event);
     877            node = frame->eventHandler()->hitTestResultAtPoint(mouseEvent->absoluteLocation(), false).innerNonSharedNode();
     878            break;
     879        }
     880    }
     881    if (node.get())
     882        printf(" originating from %s\n", drtDumpPath(node.get()).utf8().data());
     883    else
     884        printf("\n");
     885
     886    if (waitForPolicy && !shouldWaitForResponse)
     887        gTestRunner->notifyDone();
     888}
     889
     890void DumpRenderTree::didDecidePolicyForResponse(const WebCore::ResourceResponse& response)
     891{
     892    if (!testDone && m_policyDelegateEnabled) {
     893        if (WebCore::contentDispositionType(response.httpHeaderField("Content-Disposition")) == WebCore::ContentDispositionAttachment)
     894            printf("Policy delegate: resource is an attachment, suggested file name '%s'\n", response.suggestedFilename().utf8().data());
     895        if (waitForPolicy)
     896            gTestRunner->notifyDone();
     897    }
    867898}
    868899
     
    899930}
    900931
     932void DumpRenderTree::setCustomPolicyDelegate(bool setDelegate, bool permissive)
     933{
     934    m_policyDelegateEnabled = setDelegate;
     935    UNUSED_PARAM(permissive);
     936}
    901937}
    902938}
  • trunk/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h

    r133166 r136940  
    7272    void didClearWindowObjectInWorld(WebCore::DOMWrapperWorld*, JSGlobalContextRef, JSObjectRef windowObject);
    7373    void didReceiveTitleForFrame(const String& title, WebCore::Frame*);
    74     void didDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&);
     74    void didDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WebCore::Frame*);
     75    void didDecidePolicyForResponse(const WebCore::ResourceResponse&);
    7576    void didDispatchWillPerformClientRedirect();
    7677    void didHandleOnloadEventsForFrame(WebCore::Frame*);
     
    108109    // BlackBerry::Platform::BlackBerryPlatformLayoutTestClient method
    109110    virtual void addTest(const char* testFile);
     111    void setCustomPolicyDelegate(bool setDelegate, bool permissive);
    110112private:
    111113    void runTest(const String& url, const String& imageHash);
     
    148150    bool m_loadFinished;
    149151    static bool s_selectTrailingWhitespaceEnabled;
     152    bool m_policyDelegateEnabled;
    150153};
    151154}
  • trunk/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp

    r136323 r136940  
    192192void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive)
    193193{
    194     UNUSED_PARAM(setDelegate);
    195     UNUSED_PARAM(permissive);
    196     notImplemented();
     194    BlackBerry::WebKit::DumpRenderTree::currentInstance()->setCustomPolicyDelegate(setDelegate, permissive);
    197195}
    198196
     
    303301void TestRunner::waitForPolicyDelegate()
    304302{
     303    setCustomPolicyDelegate(true, true);
    305304    setWaitToDump(true);
    306305    waitForPolicy = true;
     
    440439    else if (keyStr == "WebSocketsEnabled")
    441440        BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setWebSocketsEnabled(valueStr == "true" || valueStr == "1");
     441    else if (keyStr == "WebKitDefaultTextEncodingName")
     442        BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setDefaultTextEncodingName(valueStr);
    442443}
    443444
Note: See TracChangeset for help on using the changeset viewer.