Title: [143480] trunk/Tools
Revision
143480
Author
joc...@chromium.org
Date
2013-02-20 10:45:45 -0800 (Wed, 20 Feb 2013)

Log Message

[chromium] use a WebTestProxyBase pointer to identify the window we need the history for
https://bugs.webkit.org/show_bug.cgi?id=110346

Reviewed by Adam Barth.

Using an index is very brittle, as the TestRunner API does not define
any ordering of windows.

Also, make TestRunner::shouldDumpBackForwardList() so content shell can
trigger the capturing in the browser process before generating the
text dump.

* DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
(WebTestRunner):
(WebTestRunner::WebTestDelegate::captureHistoryForWindow):
* DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h:
(WebTestRunner):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
(TestRunner):
* DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp:
(WebTestRunner::WebTestProxyBase::captureTree):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::captureHistoryForWindow):
* DumpRenderTree/chromium/WebViewHost.h:
(WebViewHost):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (143479 => 143480)


--- trunk/Tools/ChangeLog	2013-02-20 18:45:22 UTC (rev 143479)
+++ trunk/Tools/ChangeLog	2013-02-20 18:45:45 UTC (rev 143480)
@@ -1,3 +1,31 @@
+2013-02-20  Jochen Eisinger  <joc...@chromium.org>
+
+        [chromium] use a WebTestProxyBase pointer to identify the window we need the history for
+        https://bugs.webkit.org/show_bug.cgi?id=110346
+
+        Reviewed by Adam Barth.
+
+        Using an index is very brittle, as the TestRunner API does not define
+        any ordering of windows.
+
+        Also, make TestRunner::shouldDumpBackForwardList() so content shell can
+        trigger the capturing in the browser process before generating the
+        text dump.
+
+        * DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
+        (WebTestRunner):
+        (WebTestRunner::WebTestDelegate::captureHistoryForWindow):
+        * DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h:
+        (WebTestRunner):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
+        (TestRunner):
+        * DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp:
+        (WebTestRunner::WebTestProxyBase::captureTree):
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::captureHistoryForWindow):
+        * DumpRenderTree/chromium/WebViewHost.h:
+        (WebViewHost):
+
 2013-02-19  Rouslan Solomakhin  <rous...@chromium.org>
 
         [Chromium] Serve spellcheck suggestions for editing/spelling/spelling-changed-text.html from cache

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h (143479 => 143480)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h	2013-02-20 18:45:22 UTC (rev 143479)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h	2013-02-20 18:45:45 UTC (rev 143480)
@@ -36,6 +36,8 @@
 #include "Platform/chromium/public/WebVector.h"
 #include <string>
 
+#define WEBTESTRUNNER_NEW_HISTORY_CAPTURE
+
 namespace WebKit {
 class WebGamepads;
 class WebHistoryItem;
@@ -47,6 +49,7 @@
 
 struct WebPreferences;
 class WebTask;
+class WebTestProxyBase;
 
 class WebTestDelegate {
 public:
@@ -93,7 +96,7 @@
     virtual void reload() { }
     virtual void loadURLForFrame(const WebKit::WebURL&, const std::string&) { }
     virtual bool allowExternalPages() { return false; }
-    virtual void captureHistoryForWindow(size_t windowIndex, WebKit::WebVector<WebKit::WebHistoryItem>* history, size_t* currentEntryIndex) { }
+    virtual void captureHistoryForWindow(WebTestProxyBase*, WebKit::WebVector<WebKit::WebHistoryItem>* history, size_t* currentEntryIndex) { }
 };
 
 }

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


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h	2013-02-20 18:45:22 UTC (rev 143479)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h	2013-02-20 18:45:45 UTC (rev 143480)
@@ -43,6 +43,7 @@
     virtual bool shouldGeneratePixelResults() = 0;
     virtual bool shouldDumpAsAudio() const = 0;
     virtual const WebKit::WebArrayBufferView* audioData() const = 0;
+    virtual bool shouldDumpBackForwardList() const = 0;
     virtual WebKit::WebPermissionClient* webPermissions() const = 0;
 };
 

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h (143479 => 143480)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2013-02-20 18:45:22 UTC (rev 143479)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2013-02-20 18:45:45 UTC (rev 143480)
@@ -78,6 +78,7 @@
     virtual bool shouldGeneratePixelResults() OVERRIDE;
     virtual bool shouldDumpAsAudio() const OVERRIDE;
     virtual const WebKit::WebArrayBufferView* audioData() const OVERRIDE;
+    virtual bool shouldDumpBackForwardList() const OVERRIDE;
     virtual WebKit::WebPermissionClient* webPermissions() const OVERRIDE;
 
     // Methods used by WebTestProxyBase.
@@ -86,7 +87,6 @@
     bool sweepHorizontally() const;
     bool isPrinting() const;
     bool shouldDumpAsText();
-    bool shouldDumpBackForwardList() const;
     bool shouldDumpChildFrameScrollPositions() const;
     bool shouldDumpChildFramesAsText() const;
     void showDevTools();

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


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp	2013-02-20 18:45:22 UTC (rev 143479)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp	2013-02-20 18:45:45 UTC (rev 143480)
@@ -400,13 +400,14 @@
     result.append("===============================================\n");
 }
 
-string dumpAllBackForwardLists(WebTestDelegate* delegate, unsigned windowCount)
+string dumpAllBackForwardLists(TestInterfaces* interfaces, WebTestDelegate* delegate)
 {
     string result;
-    for (unsigned i = 0; i < windowCount; ++i) {
+    const vector<WebTestProxyBase*>& windowList = interfaces->windowList();
+    for (unsigned i = 0; i < windowList.size(); ++i) {
         size_t currentEntryIndex = 0;
         WebVector<WebHistoryItem> history;
-        delegate->captureHistoryForWindow(i, &history, &currentEntryIndex);
+        delegate->captureHistoryForWindow(windowList.at(i), &history, &currentEntryIndex);
         dumpBackForwardList(history, currentEntryIndex, result);
     }
     return result;
@@ -488,7 +489,7 @@
     }
 
     if (m_testInterfaces->testRunner()->shouldDumpBackForwardList())
-        dataUtf8 += dumpAllBackForwardLists(m_delegate, m_testInterfaces->windowList().size());
+        dataUtf8 += dumpAllBackForwardLists(m_testInterfaces, m_delegate);
 
     return dataUtf8;
 }

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (143479 => 143480)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-02-20 18:45:22 UTC (rev 143479)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-02-20 18:45:45 UTC (rev 143480)
@@ -713,9 +713,12 @@
     return m_shell->allowExternalPages();
 }
 
-void WebViewHost::captureHistoryForWindow(size_t windowIndex, WebVector<WebHistoryItem>* history, size_t* currentEntryIndex)
+void WebViewHost::captureHistoryForWindow(WebTestProxyBase* proxy, WebVector<WebHistoryItem>* history, size_t* currentEntryIndex)
 {
-    m_shell->captureHistoryForWindow(windowIndex, history, currentEntryIndex);
+    for (size_t i = 0; i < m_shell->windowList().size(); ++i) {
+        if (m_shell->windowList()[i]->proxy() == proxy)
+            m_shell->captureHistoryForWindow(i, history, currentEntryIndex);
+    }
 }
 
 // Public functions -----------------------------------------------------------

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.h (143479 => 143480)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-02-20 18:45:22 UTC (rev 143479)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-02-20 18:45:45 UTC (rev 143480)
@@ -119,7 +119,7 @@
     virtual void reload() OVERRIDE;
     virtual void loadURLForFrame(const WebKit::WebURL&, const std::string& frameName) OVERRIDE;
     virtual bool allowExternalPages() OVERRIDE;
-    virtual void captureHistoryForWindow(size_t windowIndex, WebKit::WebVector<WebKit::WebHistoryItem>*, size_t* currentEntryIndex) OVERRIDE;
+    virtual void captureHistoryForWindow(WebTestRunner::WebTestProxyBase*, WebKit::WebVector<WebKit::WebHistoryItem>*, size_t* currentEntryIndex) OVERRIDE;
 
     // NavigationHost
     virtual bool navigate(const TestNavigationEntry&, bool reload);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to