Title: [140889] trunk/Tools
Revision
140889
Author
[email protected]
Date
2013-01-25 17:32:15 -0800 (Fri, 25 Jan 2013)

Log 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):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (140888 => 140889)


--- trunk/Tools/ChangeLog	2013-01-26 01:29:06 UTC (rev 140888)
+++ trunk/Tools/ChangeLog	2013-01-26 01:32:15 UTC (rev 140889)
@@ -1,3 +1,43 @@
+2013-01-25  Jochen Eisinger  <[email protected]>
+
+        [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):
+
 2013-01-25  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r140774.

Modified: trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp (140888 => 140889)


--- trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp	2013-01-26 01:29:06 UTC (rev 140888)
+++ trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp	2013-01-26 01:32:15 UTC (rev 140889)
@@ -120,7 +120,7 @@
 
 void DRTTestRunner::WorkQueue::processWorkSoon()
 {
-    if (m_controller->m_shell->webViewHost()->topLoadingFrame())
+    if (m_controller->topLoadingFrame())
         return;
 
     if (!m_queue.isEmpty()) {
@@ -141,7 +141,7 @@
             return;
     }
 
-    if (!m_controller->m_waitUntilDone && !shell->webViewHost()->topLoadingFrame())
+    if (!m_controller->m_waitUntilDone && !m_controller->topLoadingFrame())
         shell->testFinished();
 }
 
@@ -180,7 +180,7 @@
 
 void DRTTestRunner::completeNotifyDone(bool isTimeout)
 {
-    if (m_waitUntilDone && !m_shell->webViewHost()->topLoadingFrame() && m_workQueue.isEmpty()) {
+    if (m_waitUntilDone && !topLoadingFrame() && m_workQueue.isEmpty()) {
         if (isTimeout)
             m_shell->testTimedOut();
         else

Modified: trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h (140888 => 140889)


--- trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h	2013-01-26 01:29:06 UTC (rev 140888)
+++ trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h	2013-01-26 01:32:15 UTC (rev 140889)
@@ -110,7 +110,7 @@
     }
 
     // Called by the webview delegate when the toplevel frame load is done.
-    void locationChangeDone();
+    virtual void locationChangeDone();
 
     // Called by the webview delegate when the policy delegate runs if the
     // waitForPolicyDelegate was called.

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h (140888 => 140889)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h	2013-01-26 01:29:06 UTC (rev 140888)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h	2013-01-26 01:32:15 UTC (rev 140889)
@@ -148,6 +148,8 @@
     bool runModalBeforeUnloadDialog(WebKit::WebFrame*, const WebKit::WebString&);
 
 private:
+    void locationChangeDone(WebKit::WebFrame*);
+
     WebTestInterfaces* m_testInterfaces;
     WebTestDelegate* m_delegate;
 

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h (140888 => 140889)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h	2013-01-26 01:29:06 UTC (rev 140888)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h	2013-01-26 01:32:15 UTC (rev 140889)
@@ -80,6 +80,8 @@
     virtual const std::set<std::string>* httpHeadersToClear() const { return 0; }
     virtual bool shouldBlockRedirects() const { return false; }
     virtual bool willSendRequestShouldReturnNull() const { return false; }
+    virtual void setTopLoadingFrame(WebKit::WebFrame*, bool) { }
+    virtual WebKit::WebFrame* topLoadingFrame() const { return 0; }
 };
 
 }

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp (140888 => 140889)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp	2013-01-26 01:29:06 UTC (rev 140888)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp	2013-01-26 01:32:15 UTC (rev 140889)
@@ -106,6 +106,7 @@
     : m_testIsRunning(false)
     , m_delegate(0)
     , m_webView(0)
+    , m_topLoadingFrame(0)
     , m_intentClient(adoptPtr(new EmptyWebDeliveredIntentClient))
     , m_webPermissions(adoptPtr(new WebPermissions))
 {
@@ -301,6 +302,7 @@
         m_webView->removeAllUserContent();
         m_webView->disableAutoResizeMode();
     }
+    m_topLoadingFrame = 0;
     WebSecurityPolicy::resetOriginAccessWhitelists();
 #if OS(LINUX) || OS(ANDROID)
     WebFontRendering::setSubpixelPositioning(false);
@@ -522,6 +524,22 @@
     return m_willSendRequestShouldReturnNull;
 }
 
+void TestRunner::setTopLoadingFrame(WebFrame* frame, bool clear)
+{
+    if (frame->top()->view() != m_webView)
+        return;
+    if (clear) {
+        m_topLoadingFrame = 0;
+        locationChangeDone();
+    } else if (!m_topLoadingFrame)
+        m_topLoadingFrame = frame;
+}
+
+WebFrame* TestRunner::topLoadingFrame() const
+{
+    return m_topLoadingFrame;
+}
+
 void TestRunner::dumpPermissionClientCallbacks(const CppArgumentList&, CppVariant* result)
 {
     m_webPermissions->setDumpCallbacks(true);

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h (140888 => 140889)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2013-01-26 01:29:06 UTC (rev 140888)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2013-01-26 01:32:15 UTC (rev 140889)
@@ -98,6 +98,8 @@
     virtual const std::set<std::string>* httpHeadersToClear() const OVERRIDE;
     virtual bool shouldBlockRedirects() const OVERRIDE;
     virtual bool willSendRequestShouldReturnNull() const OVERRIDE;
+    virtual void setTopLoadingFrame(WebKit::WebFrame*, bool) OVERRIDE;
+    virtual WebKit::WebFrame* topLoadingFrame() const OVERRIDE;
 
 protected:
     // FIXME: make these private once the move from DRTTestRunner to TestRunner
@@ -108,6 +110,11 @@
 
     void printErrorMessage(const std::string&);
 
+    // In the Mac code, this is called to trigger the end of a test after the
+    // page has finished loading. From here, we can generate the dump for the
+    // test.
+    virtual void locationChangeDone() { }
+
 private:
     ///////////////////////////////////////////////////////////////////////////
     // Methods implemented entirely in terms of chromium's public WebKit API
@@ -550,6 +557,9 @@
     WebTestDelegate* m_delegate;
     WebKit::WebView* m_webView;
 
+    // This is non-0 IFF a load is in progress.
+    WebKit::WebFrame* m_topLoadingFrame;
+
     // Mock object for testing delivering web intents.
     OwnPtr<WebKit::WebDeliveredIntentClient> m_intentClient;
 

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp (140888 => 140889)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp	2013-01-26 01:29:06 UTC (rev 140888)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp	2013-01-26 01:32:15 UTC (rev 140889)
@@ -587,6 +587,9 @@
 
 void WebTestProxyBase::didStartProvisionalLoad(WebFrame* frame)
 {
+    if (m_testInterfaces->testRunner() && !m_testInterfaces->testRunner()->topLoadingFrame())
+        m_testInterfaces->testRunner()->setTopLoadingFrame(frame, false);
+
     if (m_testInterfaces->testRunner() && m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) {
         printFrameDescription(m_delegate, frame);
         m_delegate->printMessage(" - didStartProvisionalLoadForFrame\n");
@@ -616,6 +619,7 @@
         printFrameDescription(m_delegate, frame);
         m_delegate->printMessage(" - didFailProvisionalLoadWithError\n");
     }
+    locationChangeDone(frame);
 }
 
 void WebTestProxyBase::didCommitProvisionalLoad(WebFrame* frame, bool)
@@ -672,6 +676,7 @@
         printFrameDescription(m_delegate, frame);
         m_delegate->printMessage(" - didFailLoadWithError\n");
     }
+    locationChangeDone(frame);
 }
 
 void WebTestProxyBase::didFinishLoad(WebFrame* frame)
@@ -680,6 +685,7 @@
         printFrameDescription(m_delegate, frame);
         m_delegate->printMessage(" - didFinishLoadForFrame\n");
     }
+    locationChangeDone(frame);
 }
 
 void WebTestProxyBase::didChangeLocationWithinPage(WebFrame* frame)
@@ -879,4 +885,13 @@
     return true;
 }
 
+void WebTestProxyBase::locationChangeDone(WebFrame* frame)
+{
+    if (!m_testInterfaces->testRunner())
+        return;
+    if (frame != m_testInterfaces->testRunner()->topLoadingFrame())
+        return;
+    m_testInterfaces->testRunner()->setTopLoadingFrame(frame, true);
 }
+
+}

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (140888 => 140889)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-01-26 01:29:06 UTC (rev 140888)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-01-26 01:32:15 UTC (rev 140889)
@@ -688,27 +688,6 @@
         ds->setDeferMainResourceDataLoad(false);
 }
 
-void WebViewHost::didStartProvisionalLoad(WebFrame* frame)
-{
-    if (!m_topLoadingFrame)
-        m_topLoadingFrame = frame;
-
-    updateAddressBar(frame->view());
-}
-
-void WebViewHost::didReceiveServerRedirectForProvisionalLoad(WebFrame* frame)
-{
-    updateAddressBar(frame->view());
-}
-
-void WebViewHost::didFailProvisionalLoad(WebFrame* frame, const WebURLError& error)
-{
-    locationChangeDone(frame);
-
-    // Don't display an error page if we're running layout tests, because
-    // DumpRenderTree doesn't.
-}
-
 void WebViewHost::didCommitProvisionalLoad(WebFrame* frame, bool isNewNavigation)
 {
     updateForCommittedLoad(frame, isNewNavigation);
@@ -724,17 +703,6 @@
     setPageTitle(title);
 }
 
-void WebViewHost::didFailLoad(WebFrame* frame, const WebURLError& error)
-{
-    locationChangeDone(frame);
-}
-
-void WebViewHost::didFinishLoad(WebFrame* frame)
-{
-    updateAddressBar(frame->view());
-    locationChangeDone(frame);
-}
-
 void WebViewHost::didNavigateWithinPage(WebFrame* frame, bool isNewNavigation)
 {
     frame->dataSource()->setExtraData(m_pendingExtraData.leakPtr());
@@ -1154,7 +1122,6 @@
     m_policyDelegateEnabled = false;
     m_policyDelegateIsPermissive = false;
     m_policyDelegateShouldNotifyDone = false;
-    m_topLoadingFrame = 0;
     m_pageId = -1;
     m_lastPageIdUpdated = -1;
     m_hasWindow = false;
@@ -1288,26 +1255,6 @@
     return m_shell->testRunner();
 }
 
-void WebViewHost::updateAddressBar(WebView* webView)
-{
-    WebFrame* mainFrame = webView->mainFrame();
-    WebDataSource* dataSource = mainFrame->dataSource();
-    if (!dataSource)
-        dataSource = mainFrame->provisionalDataSource();
-    if (!dataSource)
-        return;
-
-    setAddressBarURL(dataSource->request().url());
-}
-
-void WebViewHost::locationChangeDone(WebFrame* frame)
-{
-    if (frame != m_topLoadingFrame)
-        return;
-    m_topLoadingFrame = 0;
-    testRunner()->locationChangeDone();
-}
-
 void WebViewHost::updateForCommittedLoad(WebFrame* frame, bool isNewNavigation)
 {
     // Code duplicated from RenderView::DidCommitLoadForFrame.
@@ -1352,7 +1299,6 @@
         entry->setContentState(historyItem);
 
     navigationController()->didNavigateToEntry(entry.get());
-    updateAddressBar(frame->view());
     m_lastPageIdUpdated = max(m_lastPageIdUpdated, m_pageId);
 }
 
@@ -1403,11 +1349,6 @@
     // Nothing to do in layout test.
 }
 
-void WebViewHost::setAddressBarURL(const WebURL&)
-{
-    // Nothing to do in layout test.
-}
-
 void WebViewHost::enterFullScreenNow()
 {
     webView()->willEnterFullScreen();

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.h (140888 => 140889)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-01-26 01:29:06 UTC (rev 140888)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-01-26 01:32:15 UTC (rev 140889)
@@ -88,7 +88,6 @@
     void reset();
     void waitForPolicyDelegate();
     void setCustomPolicyDelegate(bool, bool);
-    WebKit::WebFrame* topLoadingFrame() { return m_topLoadingFrame; }
     void setPendingExtraData(PassOwnPtr<TestShellExtraData>);
 
     void paintRect(const WebKit::WebRect&);
@@ -260,14 +259,9 @@
     virtual WebKit::WebURLError cancelledError(WebKit::WebFrame*, const WebKit::WebURLRequest&);
     virtual void unableToImplementPolicyWithError(WebKit::WebFrame*, const WebKit::WebURLError&);
     virtual void didCreateDataSource(WebKit::WebFrame*, WebKit::WebDataSource*);
-    virtual void didStartProvisionalLoad(WebKit::WebFrame*);
-    virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame*);
-    virtual void didFailProvisionalLoad(WebKit::WebFrame*, const WebKit::WebURLError&);
     virtual void didCommitProvisionalLoad(WebKit::WebFrame*, bool isNewNavigation);
     virtual void didClearWindowObject(WebKit::WebFrame*);
     virtual void didReceiveTitle(WebKit::WebFrame*, const WebKit::WebString&, WebKit::WebTextDirection);
-    virtual void didFailLoad(WebKit::WebFrame*, const WebKit::WebURLError&);
-    virtual void didFinishLoad(WebKit::WebFrame*);
     virtual void didNavigateWithinPage(WebKit::WebFrame*, bool isNewNavigation);
     virtual void willSendRequest(WebKit::WebFrame*, unsigned identifier, WebKit::WebURLRequest&, const WebKit::WebURLResponse&);
     virtual void openFileSystem(WebKit::WebFrame*, WebKit::WebFileSystem::Type, long long size, bool create, WebKit::WebFileSystemCallbacks*);
@@ -306,22 +300,9 @@
     // Can be used to update the title of the window.
     void setPageTitle(const WebKit::WebString&);
 
-    // Called when the URL of the page changes.
-    // Extracts the URL and forwards on to SetAddressBarURL().
-    void updateAddressBar(WebKit::WebView*);
-
-    // Called when the URL of the page changes.
-    // Should be used to update the text of the URL bar.
-    void setAddressBarURL(const WebKit::WebURL&);
-
     void enterFullScreenNow();
     void exitFullScreenNow();
 
-    // In the Mac code, this is called to trigger the end of a test after the
-    // page has finished loading. From here, we can generate the dump for the
-    // test.
-    void locationChangeDone(WebKit::WebFrame*);
-
     void updateForCommittedLoad(WebKit::WebFrame*, bool isNewNavigation);
     void updateURL(WebKit::WebFrame*);
     void updateSessionHistory(WebKit::WebFrame*);
@@ -359,9 +340,6 @@
     // This delegate works for the following widget.
     WebKit::WebWidget* m_webWidget;
 
-    // This is non-0 IFF a load is in progress.
-    WebKit::WebFrame* m_topLoadingFrame;
-
     // For tracking session history. See RenderView.
     int m_pageId;
     int m_lastPageIdUpdated;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to