Changeset 140889 in webkit


Ignore:
Timestamp:
Jan 25, 2013 5:32:15 PM (11 years ago)
Author:
jochen@chromium.org
Message:

[chromium] move tracking of the top loading frame to TestRunner library
https://bugs.webkit.org/show_bug.cgi?id=107948

Reviewed by Adam Barth.

  • DumpRenderTree/chromium/DRTTestRunner.cpp:

(DRTTestRunner::WorkQueue::processWorkSoon):
(DRTTestRunner::WorkQueue::processWork):
(DRTTestRunner::completeNotifyDone):

  • DumpRenderTree/chromium/DRTTestRunner.h:

(DRTTestRunner):

  • DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:

(WebTestProxyBase):

  • DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h:

(WebTestRunner::WebTestRunner::setTopLoadingFrame):
(WebTestRunner::WebTestRunner::topLoadingFrame):

  • DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:

(WebTestRunner::TestRunner::TestRunner):
(WebTestRunner::TestRunner::reset):
(WebTestRunner::TestRunner::setTopLoadingFrame):
(WebTestRunner):
(WebTestRunner::TestRunner::topLoadingFrame):

  • DumpRenderTree/chromium/TestRunner/src/TestRunner.h:

(TestRunner):
(WebTestRunner::TestRunner::locationChangeDone):

  • DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp:

(WebTestRunner::WebTestProxyBase::didStartProvisionalLoad):
(WebTestRunner::WebTestProxyBase::didFailProvisionalLoad):
(WebTestRunner::WebTestProxyBase::didFailLoad):
(WebTestRunner::WebTestProxyBase::didFinishLoad):
(WebTestRunner::WebTestProxyBase::locationChangeDone):
(WebTestRunner):

  • DumpRenderTree/chromium/WebViewHost.cpp:

(WebViewHost::reset):
(WebViewHost::updateURL):

  • DumpRenderTree/chromium/WebViewHost.h:

(WebViewHost):

Location:
trunk/Tools
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r140808 r140889  
     12013-01-25  Jochen Eisinger  <jochen@chromium.org>
     2
     3        [chromium] move tracking of the top loading frame to TestRunner library
     4        https://bugs.webkit.org/show_bug.cgi?id=107948
     5
     6        Reviewed by Adam Barth.
     7
     8        * DumpRenderTree/chromium/DRTTestRunner.cpp:
     9        (DRTTestRunner::WorkQueue::processWorkSoon):
     10        (DRTTestRunner::WorkQueue::processWork):
     11        (DRTTestRunner::completeNotifyDone):
     12        * DumpRenderTree/chromium/DRTTestRunner.h:
     13        (DRTTestRunner):
     14        * DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:
     15        (WebTestProxyBase):
     16        * DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h:
     17        (WebTestRunner::WebTestRunner::setTopLoadingFrame):
     18        (WebTestRunner::WebTestRunner::topLoadingFrame):
     19        * DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
     20        (WebTestRunner::TestRunner::TestRunner):
     21        (WebTestRunner::TestRunner::reset):
     22        (WebTestRunner::TestRunner::setTopLoadingFrame):
     23        (WebTestRunner):
     24        (WebTestRunner::TestRunner::topLoadingFrame):
     25        * DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
     26        (TestRunner):
     27        (WebTestRunner::TestRunner::locationChangeDone):
     28        * DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp:
     29        (WebTestRunner::WebTestProxyBase::didStartProvisionalLoad):
     30        (WebTestRunner::WebTestProxyBase::didFailProvisionalLoad):
     31        (WebTestRunner::WebTestProxyBase::didFailLoad):
     32        (WebTestRunner::WebTestProxyBase::didFinishLoad):
     33        (WebTestRunner::WebTestProxyBase::locationChangeDone):
     34        (WebTestRunner):
     35        * DumpRenderTree/chromium/WebViewHost.cpp:
     36        (WebViewHost::reset):
     37        (WebViewHost::updateURL):
     38        * DumpRenderTree/chromium/WebViewHost.h:
     39        (WebViewHost):
     40
    1412013-01-25  Sheriff Bot  <webkit.review.bot@gmail.com>
    242
  • trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp

    r140565 r140889  
    121121void DRTTestRunner::WorkQueue::processWorkSoon()
    122122{
    123     if (m_controller->m_shell->webViewHost()->topLoadingFrame())
     123    if (m_controller->topLoadingFrame())
    124124        return;
    125125
     
    142142    }
    143143
    144     if (!m_controller->m_waitUntilDone && !shell->webViewHost()->topLoadingFrame())
     144    if (!m_controller->m_waitUntilDone && !m_controller->topLoadingFrame())
    145145        shell->testFinished();
    146146}
     
    181181void DRTTestRunner::completeNotifyDone(bool isTimeout)
    182182{
    183     if (m_waitUntilDone && !m_shell->webViewHost()->topLoadingFrame() && m_workQueue.isEmpty()) {
     183    if (m_waitUntilDone && !topLoadingFrame() && m_workQueue.isEmpty()) {
    184184        if (isTimeout)
    185185            m_shell->testTimedOut();
  • trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h

    r140565 r140889  
    111111
    112112    // Called by the webview delegate when the toplevel frame load is done.
    113     void locationChangeDone();
     113    virtual void locationChangeDone();
    114114
    115115    // Called by the webview delegate when the policy delegate runs if the
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h

    r140668 r140889  
    149149
    150150private:
     151    void locationChangeDone(WebKit::WebFrame*);
     152
    151153    WebTestInterfaces* m_testInterfaces;
    152154    WebTestDelegate* m_delegate;
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h

    r140318 r140889  
    8181    virtual bool shouldBlockRedirects() const { return false; }
    8282    virtual bool willSendRequestShouldReturnNull() const { return false; }
     83    virtual void setTopLoadingFrame(WebKit::WebFrame*, bool) { }
     84    virtual WebKit::WebFrame* topLoadingFrame() const { return 0; }
    8385};
    8486
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp

    r140565 r140889  
    107107    , m_delegate(0)
    108108    , m_webView(0)
     109    , m_topLoadingFrame(0)
    109110    , m_intentClient(adoptPtr(new EmptyWebDeliveredIntentClient))
    110111    , m_webPermissions(adoptPtr(new WebPermissions))
     
    302303        m_webView->disableAutoResizeMode();
    303304    }
     305    m_topLoadingFrame = 0;
    304306    WebSecurityPolicy::resetOriginAccessWhitelists();
    305307#if OS(LINUX) || OS(ANDROID)
     
    521523{
    522524    return m_willSendRequestShouldReturnNull;
     525}
     526
     527void TestRunner::setTopLoadingFrame(WebFrame* frame, bool clear)
     528{
     529    if (frame->top()->view() != m_webView)
     530        return;
     531    if (clear) {
     532        m_topLoadingFrame = 0;
     533        locationChangeDone();
     534    } else if (!m_topLoadingFrame)
     535        m_topLoadingFrame = frame;
     536}
     537
     538WebFrame* TestRunner::topLoadingFrame() const
     539{
     540    return m_topLoadingFrame;
    523541}
    524542
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h

    r140565 r140889  
    9999    virtual bool shouldBlockRedirects() const OVERRIDE;
    100100    virtual bool willSendRequestShouldReturnNull() const OVERRIDE;
     101    virtual void setTopLoadingFrame(WebKit::WebFrame*, bool) OVERRIDE;
     102    virtual WebKit::WebFrame* topLoadingFrame() const OVERRIDE;
    101103
    102104protected:
     
    108110
    109111    void printErrorMessage(const std::string&);
     112
     113    // In the Mac code, this is called to trigger the end of a test after the
     114    // page has finished loading. From here, we can generate the dump for the
     115    // test.
     116    virtual void locationChangeDone() { }
    110117
    111118private:
     
    551558    WebKit::WebView* m_webView;
    552559
     560    // This is non-0 IFF a load is in progress.
     561    WebKit::WebFrame* m_topLoadingFrame;
     562
    553563    // Mock object for testing delivering web intents.
    554564    OwnPtr<WebKit::WebDeliveredIntentClient> m_intentClient;
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp

    r140668 r140889  
    588588void WebTestProxyBase::didStartProvisionalLoad(WebFrame* frame)
    589589{
     590    if (m_testInterfaces->testRunner() && !m_testInterfaces->testRunner()->topLoadingFrame())
     591        m_testInterfaces->testRunner()->setTopLoadingFrame(frame, false);
     592
    590593    if (m_testInterfaces->testRunner() && m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) {
    591594        printFrameDescription(m_delegate, frame);
     
    617620        m_delegate->printMessage(" - didFailProvisionalLoadWithError\n");
    618621    }
     622    locationChangeDone(frame);
    619623}
    620624
     
    673677        m_delegate->printMessage(" - didFailLoadWithError\n");
    674678    }
     679    locationChangeDone(frame);
    675680}
    676681
     
    681686        m_delegate->printMessage(" - didFinishLoadForFrame\n");
    682687    }
     688    locationChangeDone(frame);
    683689}
    684690
     
    880886}
    881887
    882 }
     888void WebTestProxyBase::locationChangeDone(WebFrame* frame)
     889{
     890    if (!m_testInterfaces->testRunner())
     891        return;
     892    if (frame != m_testInterfaces->testRunner()->topLoadingFrame())
     893        return;
     894    m_testInterfaces->testRunner()->setTopLoadingFrame(frame, true);
     895}
     896
     897}
  • trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp

    r140808 r140889  
    689689}
    690690
    691 void WebViewHost::didStartProvisionalLoad(WebFrame* frame)
    692 {
    693     if (!m_topLoadingFrame)
    694         m_topLoadingFrame = frame;
    695 
    696     updateAddressBar(frame->view());
    697 }
    698 
    699 void WebViewHost::didReceiveServerRedirectForProvisionalLoad(WebFrame* frame)
    700 {
    701     updateAddressBar(frame->view());
    702 }
    703 
    704 void WebViewHost::didFailProvisionalLoad(WebFrame* frame, const WebURLError& error)
    705 {
    706     locationChangeDone(frame);
    707 
    708     // Don't display an error page if we're running layout tests, because
    709     // DumpRenderTree doesn't.
    710 }
    711 
    712691void WebViewHost::didCommitProvisionalLoad(WebFrame* frame, bool isNewNavigation)
    713692{
     
    723702{
    724703    setPageTitle(title);
    725 }
    726 
    727 void WebViewHost::didFailLoad(WebFrame* frame, const WebURLError& error)
    728 {
    729     locationChangeDone(frame);
    730 }
    731 
    732 void WebViewHost::didFinishLoad(WebFrame* frame)
    733 {
    734     updateAddressBar(frame->view());
    735     locationChangeDone(frame);
    736704}
    737705
     
    11551123    m_policyDelegateIsPermissive = false;
    11561124    m_policyDelegateShouldNotifyDone = false;
    1157     m_topLoadingFrame = 0;
    11581125    m_pageId = -1;
    11591126    m_lastPageIdUpdated = -1;
     
    12891256}
    12901257
    1291 void WebViewHost::updateAddressBar(WebView* webView)
    1292 {
    1293     WebFrame* mainFrame = webView->mainFrame();
    1294     WebDataSource* dataSource = mainFrame->dataSource();
    1295     if (!dataSource)
    1296         dataSource = mainFrame->provisionalDataSource();
    1297     if (!dataSource)
    1298         return;
    1299 
    1300     setAddressBarURL(dataSource->request().url());
    1301 }
    1302 
    1303 void WebViewHost::locationChangeDone(WebFrame* frame)
    1304 {
    1305     if (frame != m_topLoadingFrame)
    1306         return;
    1307     m_topLoadingFrame = 0;
    1308     testRunner()->locationChangeDone();
    1309 }
    1310 
    13111258void WebViewHost::updateForCommittedLoad(WebFrame* frame, bool isNewNavigation)
    13121259{
     
    13531300
    13541301    navigationController()->didNavigateToEntry(entry.get());
    1355     updateAddressBar(frame->view());
    13561302    m_lastPageIdUpdated = max(m_lastPageIdUpdated, m_pageId);
    13571303}
     
    14001346
    14011347void WebViewHost::setPageTitle(const WebString&)
    1402 {
    1403     // Nothing to do in layout test.
    1404 }
    1405 
    1406 void WebViewHost::setAddressBarURL(const WebURL&)
    14071348{
    14081349    // Nothing to do in layout test.
  • trunk/Tools/DumpRenderTree/chromium/WebViewHost.h

    r140717 r140889  
    8989    void waitForPolicyDelegate();
    9090    void setCustomPolicyDelegate(bool, bool);
    91     WebKit::WebFrame* topLoadingFrame() { return m_topLoadingFrame; }
    9291    void setPendingExtraData(PassOwnPtr<TestShellExtraData>);
    9392
     
    261260    virtual void unableToImplementPolicyWithError(WebKit::WebFrame*, const WebKit::WebURLError&);
    262261    virtual void didCreateDataSource(WebKit::WebFrame*, WebKit::WebDataSource*);
    263     virtual void didStartProvisionalLoad(WebKit::WebFrame*);
    264     virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame*);
    265     virtual void didFailProvisionalLoad(WebKit::WebFrame*, const WebKit::WebURLError&);
    266262    virtual void didCommitProvisionalLoad(WebKit::WebFrame*, bool isNewNavigation);
    267263    virtual void didClearWindowObject(WebKit::WebFrame*);
    268264    virtual void didReceiveTitle(WebKit::WebFrame*, const WebKit::WebString&, WebKit::WebTextDirection);
    269     virtual void didFailLoad(WebKit::WebFrame*, const WebKit::WebURLError&);
    270     virtual void didFinishLoad(WebKit::WebFrame*);
    271265    virtual void didNavigateWithinPage(WebKit::WebFrame*, bool isNewNavigation);
    272266    virtual void willSendRequest(WebKit::WebFrame*, unsigned identifier, WebKit::WebURLRequest&, const WebKit::WebURLResponse&);
     
    307301    void setPageTitle(const WebKit::WebString&);
    308302
    309     // Called when the URL of the page changes.
    310     // Extracts the URL and forwards on to SetAddressBarURL().
    311     void updateAddressBar(WebKit::WebView*);
    312 
    313     // Called when the URL of the page changes.
    314     // Should be used to update the text of the URL bar.
    315     void setAddressBarURL(const WebKit::WebURL&);
    316 
    317303    void enterFullScreenNow();
    318304    void exitFullScreenNow();
    319 
    320     // In the Mac code, this is called to trigger the end of a test after the
    321     // page has finished loading. From here, we can generate the dump for the
    322     // test.
    323     void locationChangeDone(WebKit::WebFrame*);
    324305
    325306    void updateForCommittedLoad(WebKit::WebFrame*, bool isNewNavigation);
     
    359340    // This delegate works for the following widget.
    360341    WebKit::WebWidget* m_webWidget;
    361 
    362     // This is non-0 IFF a load is in progress.
    363     WebKit::WebFrame* m_topLoadingFrame;
    364342
    365343    // For tracking session history. See RenderView.
Note: See TracChangeset for help on using the changeset viewer.