[Qt] Port DRT to use TestRunner::dumpAsText()
authorzeno.albisser@digia.com <zeno.albisser@digia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Mar 2013 10:07:24 +0000 (10:07 +0000)
committerzeno.albisser@digia.com <zeno.albisser@digia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Mar 2013 10:07:24 +0000 (10:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=112260

Reviewed by Benjamin Poulain.

* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
(WebCore::DumpRenderTree::open):
(WebCore::methodNameStringForFailedTest):
    Change parameter from type TestRunnerQt* to TestRunner*.
(WebCore::DumpRenderTree::dump):
    TestRunnerQt::shouldDumpPixels() always returned true in our case.
    Instead we should rely on TestRunner::generatePixelResults().
* DumpRenderTree/qt/TestRunnerQt.cpp:
(TestRunnerQt::reset):
* DumpRenderTree/qt/TestRunnerQt.h:
(TestRunnerQt):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@145800 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
Tools/DumpRenderTree/qt/TestRunnerQt.cpp
Tools/DumpRenderTree/qt/TestRunnerQt.h

index c69b99a..92a06ff 100644 (file)
@@ -1,3 +1,22 @@
+2013-03-14  Zeno Albisser  <zeno@webkit.org>
+
+        [Qt] Port DRT to use TestRunner::dumpAsText()
+        https://bugs.webkit.org/show_bug.cgi?id=112260
+
+        Reviewed by Benjamin Poulain.
+
+        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+        (WebCore::DumpRenderTree::open):
+        (WebCore::methodNameStringForFailedTest):
+            Change parameter from type TestRunnerQt* to TestRunner*.
+        (WebCore::DumpRenderTree::dump):
+            TestRunnerQt::shouldDumpPixels() always returned true in our case.
+            Instead we should rely on TestRunner::generatePixelResults().
+        * DumpRenderTree/qt/TestRunnerQt.cpp:
+        (TestRunnerQt::reset):
+        * DumpRenderTree/qt/TestRunnerQt.h:
+        (TestRunnerQt):
+
 2013-03-13  Kunihiko Sakamoto  <ksakamoto@chromium.org>
 
         Implement FontLoader interface
index 198baa8..f21ade3 100755 (executable)
@@ -620,7 +620,7 @@ void DumpRenderTree::open(const QUrl& url)
         testRunner()->showWebInspector();
 
     if (isDumpAsTextTest(url))
-        testRunner()->dumpAsText();
+        m_jscController->setDumpAsText(true);
 
     if (isGlobalHistoryTest(url))
         testRunner()->dumpHistoryCallbacks();
@@ -934,10 +934,10 @@ QString DumpRenderTree::dumpBackForwardList(QWebPage* page)
     return result;
 }
 
-static const char *methodNameStringForFailedTest(TestRunnerQt *controller)
+static const char *methodNameStringForFailedTest(TestRunner *controller)
 {
     const char *errorMessage;
-    if (controller->shouldDumpAsText())
+    if (controller->dumpAsText())
         errorMessage = "[documentElement innerText]";
     // FIXME: Add when we have support
     //else if (controller->dumpDOMAsWebArchive())
@@ -965,7 +965,7 @@ void DumpRenderTree::dump()
 
     QString mimeType = DumpRenderTreeSupportQt::responseMimeType(mainFrame->handle());
     if (mimeType == "text/plain")
-        m_controller->dumpAsText();
+        m_jscController->setDumpAsText(true);
 
     // Dump render text...
     QString resultString;
@@ -974,7 +974,7 @@ void DumpRenderTree::dump()
     if (m_controller->shouldDumpAsAudio()) {
         resultContentType = "audio/wav";
         resultData = m_controller->audioData();
-    } else if (m_controller->shouldDumpAsText())
+    } else if (m_jscController->dumpAsText())
         resultString = dumpFramesAsText(mainFrame);
     else {
         resultString = DumpRenderTreeSupportQt::frameRenderTreeDump(mainFrame->handle());
@@ -996,13 +996,13 @@ void DumpRenderTree::dump()
         fprintf(stdout, "Content-Transfer-Encoding: base64\n");
         fprintf(stdout, "%s", resultData.toBase64().constData());
     } else
-        printf("ERROR: nil result from %s", methodNameStringForFailedTest(m_controller));
+        printf("ERROR: nil result from %s", methodNameStringForFailedTest(m_jscController.get()));
 
     // signal end of text block
     fputs("#EOF\n", stdout);
     fputs("#EOF\n", stderr);
 
-    if (m_dumpPixelsForCurrentTest && m_controller->shouldDumpPixels()) {
+    if (m_dumpPixelsForCurrentTest && m_jscController->generatePixelResults()) {
         QImage image;
         if (!m_controller->isPrinting()) {
             image = QImage(m_page->viewportSize(), QImage::Format_ARGB32);
index 1cbf62f..a5b81f3 100644 (file)
@@ -57,9 +57,7 @@ void TestRunnerQt::reset()
 {
     m_hasDumped = false;
     m_loadFinished = false;
-    m_textDump = false;
     m_audioDump = false;
-    m_shouldDumpPixels = true;
     m_dumpBackForwardList = false;
     m_dumpChildrenAsText = false;
     m_dumpChildFrameScrollPositions = false;
@@ -156,12 +154,6 @@ void TestRunnerQt::maybeDump(bool /*success*/)
     }
 }
 
-void TestRunnerQt::dumpAsText(bool shouldDumpPixels)
-{
-    m_textDump = true;
-    m_shouldDumpPixels = shouldDumpPixels;
-}
-
 void TestRunnerQt::waitUntilDone()
 {
     //qDebug() << ">>>>waitForDone";
index c1ca376..2c823ff 100644 (file)
@@ -59,9 +59,7 @@ public:
     TestRunnerQt(DumpRenderTree*);
 
     bool shouldDisallowIncreaseForApplicationCacheQuota() const { return m_disallowIncreaseForApplicationCacheQuota; }
-    bool shouldDumpAsText() const { return m_textDump; }
     bool shouldDumpAsAudio() const { return m_audioDump; }
-    bool shouldDumpPixels() const { return m_shouldDumpPixels; }
     bool shouldDumpBackForwardList() const { return m_dumpBackForwardList; }
     bool shouldDumpChildrenAsText() const { return m_dumpChildrenAsText; }
     bool shouldDumpChildFrameScrollPositions() const { return m_dumpChildFrameScrollPositions; }
@@ -99,7 +97,6 @@ Q_SIGNALS:
 public Q_SLOTS:
     void maybeDump(bool ok);
     void disallowIncreaseForApplicationCacheQuota() { m_disallowIncreaseForApplicationCacheQuota = true; }
-    void dumpAsText(bool shouldDumpPixels = false);
     void dumpChildFramesAsText() { m_dumpChildrenAsText = true; }
     void dumpChildFrameScrollPositions() { m_dumpChildFrameScrollPositions = true; }
     void dumpDatabaseCallbacks() { m_dumpDatabaseCallbacks = true; }
@@ -271,9 +268,7 @@ private:
 
 private:
     bool m_hasDumped;
-    bool m_textDump;
     bool m_audioDump;
-    bool m_shouldDumpPixels;
     bool m_disallowIncreaseForApplicationCacheQuota;
     bool m_dumpBackForwardList;
     bool m_dumpChildrenAsText;