Title: [122866] trunk/Tools
Revision
122866
Author
[email protected]
Date
2012-07-17 12:01:58 -0700 (Tue, 17 Jul 2012)

Log Message

[chromium] remove --test-shell support from DRT
https://bugs.webkit.org/show_bug.cgi?id=86927

Reviewed by Adam Barth.

Now no one use --test-shell. All of us use the standard DRT mode.

* DumpRenderTree/chromium/DumpRenderTree.cpp: Removed support of --test-shell and --pixel-tests=filename options. (--pixel-tests without '=' is kept for DRT mode.)
(runTest):
(main):
* DumpRenderTree/chromium/TestEventPrinter.cpp:
(TestEventPrinter::TestEventPrinter):
(TestEventPrinter::~TestEventPrinter):
(TestEventPrinter::handleTestHeader):
(TestEventPrinter::handleTimedOut):
(TestEventPrinter::handleTextHeader):
(TestEventPrinter::handleTextFooter):
(TestEventPrinter::handleAudioHeader):
(TestEventPrinter::handleAudioFooter):
(TestEventPrinter::handleImage): Removed the unused filename parameter.
(TestEventPrinter::handleTestFooter):
* DumpRenderTree/chromium/TestEventPrinter.h:
(TestEventPrinter): Made it a concrete class because we have only one implementation.
* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::TestShell):
(TestShell::initialize):
(TestShell::dumpImage):
* DumpRenderTree/chromium/TestShell.h:
(TestParams): Removed pixelFileName field.
(TestShell):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (122865 => 122866)


--- trunk/Tools/ChangeLog	2012-07-17 18:50:24 UTC (rev 122865)
+++ trunk/Tools/ChangeLog	2012-07-17 19:01:58 UTC (rev 122866)
@@ -1,5 +1,38 @@
 2012-07-17  Xianzhu Wang  <[email protected]>
 
+        [chromium] remove --test-shell support from DRT
+        https://bugs.webkit.org/show_bug.cgi?id=86927
+
+        Reviewed by Adam Barth.
+
+        Now no one use --test-shell. All of us use the standard DRT mode.
+
+        * DumpRenderTree/chromium/DumpRenderTree.cpp: Removed support of --test-shell and --pixel-tests=filename options. (--pixel-tests without '=' is kept for DRT mode.)
+        (runTest):
+        (main):
+        * DumpRenderTree/chromium/TestEventPrinter.cpp:
+        (TestEventPrinter::TestEventPrinter):
+        (TestEventPrinter::~TestEventPrinter):
+        (TestEventPrinter::handleTestHeader):
+        (TestEventPrinter::handleTimedOut):
+        (TestEventPrinter::handleTextHeader):
+        (TestEventPrinter::handleTextFooter):
+        (TestEventPrinter::handleAudioHeader):
+        (TestEventPrinter::handleAudioFooter):
+        (TestEventPrinter::handleImage): Removed the unused filename parameter.
+        (TestEventPrinter::handleTestFooter):
+        * DumpRenderTree/chromium/TestEventPrinter.h:
+        (TestEventPrinter): Made it a concrete class because we have only one implementation.
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::TestShell):
+        (TestShell::initialize):
+        (TestShell::dumpImage):
+        * DumpRenderTree/chromium/TestShell.h:
+        (TestParams): Removed pixelFileName field.
+        (TestShell):
+
+2012-07-17  Xianzhu Wang  <[email protected]>
+
         remove ChromiumDriver from NRWT
         https://bugs.webkit.org/show_bug.cgi?id=88478
 

Modified: trunk/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp (122865 => 122866)


--- trunk/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp	2012-07-17 18:50:24 UTC (rev 122865)
+++ trunk/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp	2012-07-17 19:01:58 UTC (rev 122866)
@@ -47,8 +47,6 @@
 static const char optionDebugRenderTree[] = "--debug-render-tree";
 static const char optionDebugLayerTree[] = "--debug-layer-tree";
 
-static const char optionPixelTestsWithName[] = "--pixel-tests=";
-static const char optionTestShell[] = "--test-shell";
 static const char optionAllowExternalPages[] = "--allow-external-pages";
 static const char optionStartupDialog[] = "--testshell-startup-dialog";
 static const char optionCheckLayoutTestSystemDeps[] = "--check-layout-test-sys-deps";
@@ -81,30 +79,15 @@
     }
 };
 
-static void runTest(TestShell& shell, TestParams& params, const string& testName, bool testShellMode)
+static void runTest(TestShell& shell, TestParams& params, const string& testName)
 {
     int oldTimeoutMsec = shell.layoutTestTimeout();
     params.pixelHash = "";
     string pathOrURL = testName;
-    if (testShellMode) {
-        string timeOut;
-        string::size_type separatorPosition = pathOrURL.find(' ');
-        if (separatorPosition != string::npos) {
-            timeOut = pathOrURL.substr(separatorPosition + 1);
-            pathOrURL.erase(separatorPosition);
-            separatorPosition = timeOut.find_first_of(' ');
-            if (separatorPosition != string::npos) {
-                params.pixelHash = timeOut.substr(separatorPosition + 1);
-                timeOut.erase(separatorPosition);
-            }
-            shell.setLayoutTestTimeout(atoi(timeOut.c_str()));
-        }
-    } else {
-        string::size_type separatorPosition = pathOrURL.find("'");
-        if (separatorPosition != string::npos) {
-            params.pixelHash = pathOrURL.substr(separatorPosition + 1);
-            pathOrURL.erase(separatorPosition);
-        }
+    string::size_type separatorPosition = pathOrURL.find("'");
+    if (separatorPosition != string::npos) {
+        params.pixelHash = pathOrURL.substr(separatorPosition + 1);
+        pathOrURL.erase(separatorPosition);
     }
     params.testUrl = webkit_support::CreateURLForPathOrURL(pathOrURL);
     webkit_support::SetCurrentDirectoryForFileURL(params.testUrl);
@@ -136,7 +119,6 @@
     TestParams params;
     Vector<string> tests;
     bool serverMode = false;
-    bool testShellMode = false;
     bool allowExternalPages = false;
     bool startupDialog = false;
     bool acceleratedCompositingForVideoEnabled = false;
@@ -159,17 +141,11 @@
             params.dumpTree = false;
         else if (argument == optionPixelTests)
             params.dumpPixels = true;
-        else if (!argument.find(optionPixelTestsWithName)) {
-            params.dumpPixels = true;
-            params.pixelFileName = argument.substr(strlen(optionPixelTestsWithName));
-        } else if (argument == optionDebugRenderTree)
+        else if (argument == optionDebugRenderTree)
             params.debugRenderTree = true;
         else if (argument == optionDebugLayerTree)
             params.debugLayerTree = true;
-        else if (argument == optionTestShell) {
-            testShellMode = true;
-            serverMode = true;
-        } else if (argument == optionAllowExternalPages)
+        else if (argument == optionAllowExternalPages)
             allowExternalPages = true;
         else if (argument == optionStartupDialog)
             startupDialog = true;
@@ -215,10 +191,6 @@
         else
             tests.append(argument);
     }
-    if (testShellMode && params.dumpPixels && params.pixelFileName.empty()) {
-        fprintf(stderr, "--pixel-tests with --test-shell requires a file name.\n");
-        return EXIT_FAILURE;
-    }
     if (stressOpt && stressDeopt) {
         fprintf(stderr, "--stress-opt and --stress-deopt are mutually exclusive.\n");
         return EXIT_FAILURE;
@@ -231,7 +203,6 @@
 
     { // Explicit scope for the TestShell instance.
         TestShell shell;
-        shell.setTestShellMode(testShellMode);
         shell.setAllowExternalPages(allowExternalPages);
         shell.setAcceleratedCompositingForVideoEnabled(acceleratedCompositingForVideoEnabled);
         shell.setThreadedCompositingEnabled(threadedCompositingEnabled);
@@ -265,14 +236,14 @@
                 // Explicitly quit on platforms where EOF is not reliable.
                 if (!strcmp(testString, "QUIT"))
                     break;
-                runTest(shell, params, testString, testShellMode);
+                runTest(shell, params, testString);
             }
         } else if (!tests.size())
             puts("#EOF");
         else {
             params.printSeparators = tests.size() > 1;
             for (unsigned i = 0; i < tests.size(); i++)
-                runTest(shell, params, tests[i], testShellMode);
+                runTest(shell, params, tests[i]);
         }
 
         shell.callJSGC();

Modified: trunk/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp (122865 => 122866)


--- trunk/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp	2012-07-17 18:50:24 UTC (rev 122865)
+++ trunk/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp	2012-07-17 19:01:58 UTC (rev 122866)
@@ -36,83 +36,49 @@
 #include <wtf/Assertions.h>
 #include <wtf/text/Base64.h>
 
-class DRTPrinter : public TestEventPrinter {
-public:
-    DRTPrinter() { }
-    void handleTestHeader(const char* url) const;
-    void handleTimedOut() const;
-    void handleTextHeader() const;
-    void handleTextFooter() const;
-    void handleAudioHeader() const;
-    void handleAudioFooter() const;
-    void handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char* fileName) const;
-    void handleImageFooter() const;
-    void handleTestFooter(bool dumpedAnything) const;
-};
-
-class TestShellPrinter : public TestEventPrinter {
-public:
-    TestShellPrinter() { }
-    void handleTestHeader(const char* url) const;
-    void handleTimedOut() const;
-    void handleTextHeader() const;
-    void handleTextFooter() const;
-    void handleAudioHeader() const;
-    void handleAudioFooter() const;
-    void handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char* fileName) const;
-    void handleImageFooter() const;
-    void handleTestFooter(bool dumpedAnything) const;
-};
-
-TestEventPrinter::~TestEventPrinter()
+TestEventPrinter::TestEventPrinter()
 {
 }
 
-PassOwnPtr<TestEventPrinter> TestEventPrinter::createDRTPrinter()
+TestEventPrinter::~TestEventPrinter()
 {
-    return adoptPtr(new DRTPrinter);
 }
 
-PassOwnPtr<TestEventPrinter> TestEventPrinter::createTestShellPrinter()
-{
-    return adoptPtr(new TestShellPrinter);
-}
-
 // ----------------------------------------------------------------
 
-void DRTPrinter::handleTestHeader(const char*) const
+void TestEventPrinter::handleTestHeader(const char*) const
 {
 }
 
-void DRTPrinter::handleTimedOut() const
+void TestEventPrinter::handleTimedOut() const
 {
     fprintf(stderr, "FAIL: Timed out waiting for notifyDone to be called\n");
     fprintf(stdout, "FAIL: Timed out waiting for notifyDone to be called\n");
 }
 
-void DRTPrinter::handleTextHeader() const
+void TestEventPrinter::handleTextHeader() const
 {
     printf("Content-Type: text/plain\n");
 }
 
-void DRTPrinter::handleTextFooter() const
+void TestEventPrinter::handleTextFooter() const
 {
     printf("#EOF\n");
     fprintf(stderr, "#EOF\n");
 }
 
-void DRTPrinter::handleAudioHeader() const
+void TestEventPrinter::handleAudioHeader() const
 {
     printf("Content-Type: audio/wav\n");
 }
 
-void DRTPrinter::handleAudioFooter() const
+void TestEventPrinter::handleAudioFooter() const
 {
     printf("#EOF\n");
     fprintf(stderr, "#EOF\n");
 }
 
-void DRTPrinter::handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char*) const
+void TestEventPrinter::handleImage(const char* actualHash, const char* expectedHash, const void* imageData, size_t imageSize) const
 {
     ASSERT(actualHash);
     printf("\nActualHash: %s\n", actualHash);
@@ -139,63 +105,7 @@
     }
 }
 
-void DRTPrinter::handleTestFooter(bool) const
+void TestEventPrinter::handleTestFooter(bool) const
 {
     printf("#EOF\n");
 }
-
-// ----------------------------------------------------------------
-
-void TestShellPrinter::handleTestHeader(const char* url) const
-{
-    printf("#URL:%s\n", url);
-}
-
-void TestShellPrinter::handleTimedOut() const
-{
-    puts("#TEST_TIMED_OUT\n");
-}
-
-void TestShellPrinter::handleTextHeader() const
-{
-}
-
-void TestShellPrinter::handleTextFooter() const
-{
-}
-
-void TestShellPrinter::handleAudioHeader() const
-{
-    printf("Content-Type: audio/wav\n");
-}
-
-void TestShellPrinter::handleAudioFooter() const
-{
-    printf("\n");
-}
-
-void TestShellPrinter::handleImage(const char* actualHash, const char*, const unsigned char* imageData, size_t imageSize, const char* fileName) const
-{
-    ASSERT(actualHash);
-    if (imageData && imageSize) {
-        ASSERT(fileName);
-        FILE* fp = fopen(fileName, "wb");
-        if (!fp) {
-            perror(fileName);
-            exit(EXIT_FAILURE);
-        }
-        if (fwrite(imageData, 1, imageSize, fp) != imageSize) {
-            perror(fileName);
-            fclose(fp);
-            exit(EXIT_FAILURE);
-        }
-        fclose(fp);
-    }
-    printf("#MD5:%s\n", actualHash);
-}
-
-void TestShellPrinter::handleTestFooter(bool dumpedAnything) const
-{
-    if (dumpedAnything)
-        printf("#EOF\n");
-}

Modified: trunk/Tools/DumpRenderTree/chromium/TestEventPrinter.h (122865 => 122866)


--- trunk/Tools/DumpRenderTree/chromium/TestEventPrinter.h	2012-07-17 18:50:24 UTC (rev 122865)
+++ trunk/Tools/DumpRenderTree/chromium/TestEventPrinter.h	2012-07-17 19:01:58 UTC (rev 122866)
@@ -35,18 +35,16 @@
 
 class TestEventPrinter {
 public:
-    static PassOwnPtr<TestEventPrinter> createDRTPrinter();
-    static PassOwnPtr<TestEventPrinter> createTestShellPrinter();
-
-    virtual ~TestEventPrinter();
-    virtual void handleTestHeader(const char* url) const = 0;
-    virtual void handleTimedOut() const = 0;
-    virtual void handleTextHeader() const = 0;
-    virtual void handleTextFooter() const = 0;
-    virtual void handleAudioHeader() const = 0;
-    virtual void handleAudioFooter() const = 0;
-    virtual void handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char* fileName) const = 0;
-    virtual void handleTestFooter(bool dumpedAnything) const = 0;
+    TestEventPrinter();
+    ~TestEventPrinter();
+    void handleTestHeader(const char* url) const;
+    void handleTimedOut() const;
+    void handleTextHeader() const;
+    void handleTextFooter() const;
+    void handleAudioHeader() const;
+    void handleAudioFooter() const;
+    void handleImage(const char* actualHash, const char* expectedHash, const void* imageData, size_t imageSize) const;
+    void handleTestFooter(bool dumpedAnything) const;
 };
 
 #endif // TestEventPrinter_h

Modified: trunk/Tools/DumpRenderTree/chromium/TestShell.cpp (122865 => 122866)


--- trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2012-07-17 18:50:24 UTC (rev 122865)
+++ trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2012-07-17 19:01:58 UTC (rev 122866)
@@ -105,7 +105,6 @@
     : m_testIsPending(false)
     , m_testIsPreparing(false)
     , m_focusedWidget(0)
-    , m_testShellMode(false)
     , m_devTools(0)
     , m_allowExternalPages(false)
     , m_acceleratedCompositingForVideoEnabled(false)
@@ -154,7 +153,7 @@
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
     m_notificationPresenter = adoptPtr(new NotificationPresenter(this));
 #endif
-    m_printer = m_testShellMode ? TestEventPrinter::createTestShellPrinter() : TestEventPrinter::createDRTPrinter();
+    m_printer = adoptPtr(new TestEventPrinter());
 #if ENABLE(LINK_PRERENDER)
     m_prerenderingSupport = adoptPtr(new MockWebPrerenderingSupport());
 #endif
@@ -720,9 +719,9 @@
             sourceBitmap.height(), static_cast<int>(sourceBitmap.rowBytes()), discardTransparency, md5hash, &png);
 #endif
 
-        m_printer->handleImage(md5hash.c_str(), m_params.pixelHash.c_str(), &png[0], png.size(), m_params.pixelFileName.c_str());
+        m_printer->handleImage(md5hash.c_str(), m_params.pixelHash.c_str(), &png[0], png.size());
     } else
-        m_printer->handleImage(md5hash.c_str(), m_params.pixelHash.c_str(), 0, 0, m_params.pixelFileName.c_str());
+        m_printer->handleImage(md5hash.c_str(), m_params.pixelHash.c_str(), 0, 0);
 }
 
 void TestShell::bindJSObjectsToWindow(WebFrame* frame)

Modified: trunk/Tools/DumpRenderTree/chromium/TestShell.h (122865 => 122866)


--- trunk/Tools/DumpRenderTree/chromium/TestShell.h	2012-07-17 18:50:24 UTC (rev 122865)
+++ trunk/Tools/DumpRenderTree/chromium/TestShell.h	2012-07-17 19:01:58 UTC (rev 122866)
@@ -70,8 +70,6 @@
     bool debugLayerTree;
     bool printSeparators;
     WebKit::WebURL testUrl;
-    // Resultant image file name. Required only if the test_shell mode.
-    std::string pixelFileName;
     std::string pixelHash;
 
     TestParams()
@@ -135,7 +133,6 @@
     bool allowExternalPages() const { return m_allowExternalPages; }
     void setAllowExternalPages(bool allowExternalPages) { m_allowExternalPages = allowExternalPages; }
 
-    void setTestShellMode(bool testShellMode) { m_testShellMode = testShellMode; }
     void setAcceleratedCompositingForVideoEnabled(bool enabled) { m_acceleratedCompositingForVideoEnabled = enabled; }
     void setThreadedCompositingEnabled(bool enabled) { m_threadedCompositingEnabled = enabled; }
     void setForceCompositingMode(bool enabled) { m_forceCompositingMode = enabled; }
@@ -207,7 +204,6 @@
     bool m_isLoading;
     WebKit::WebView* m_webView;
     WebKit::WebWidget* m_focusedWidget;
-    bool m_testShellMode;
     WebViewHost* m_devTools;
 
     // Be careful of the destruction order of the following objects.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to