2011-02-22 Vsevolod Vlasov <vsevik@chromium.org>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Feb 2011 05:54:13 +0000 (05:54 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Feb 2011 05:54:13 +0000 (05:54 +0000)
        Reviewed by Pavel Feldman.

        DumpRenderTree should dump as text if test path contains "dumpAsText/"
        https://bugs.webkit.org/show_bug.cgi?id=54873

        * DumpRenderTree/chromium/LayoutTestController.h:
        (LayoutTestController::setShouldDumpAsText):
        (LayoutTestController::setShouldGeneratePixelResults):
        * DumpRenderTree/chromium/TestShell.cpp:
        (TestShell::runFileTest):
        * DumpRenderTree/gtk/DumpRenderTree.cpp:
        (shouldDumpAsText):
        (dump):
        (runTest):
        * DumpRenderTree/mac/DumpRenderTree.mm:
        (shouldDumpAsText):
        (runTest):
        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
        (WebCore::isDumpAsTextTest):
        (WebCore::DumpRenderTree::open):
        * DumpRenderTree/win/DumpRenderTree.cpp:
        (shouldDumpAsText):
        (runTest):
        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
        (WTR::InjectedBundlePage::dump):

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

Tools/ChangeLog
Tools/DumpRenderTree/chromium/LayoutTestController.h
Tools/DumpRenderTree/chromium/TestShell.cpp
Tools/DumpRenderTree/gtk/DumpRenderTree.cpp
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
Tools/DumpRenderTree/win/DumpRenderTree.cpp
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

index baba6e5..8fb3785 100644 (file)
@@ -1,3 +1,31 @@
+2011-02-22  Vsevolod Vlasov  <vsevik@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        DumpRenderTree should dump as text if test path contains "dumpAsText/"
+        https://bugs.webkit.org/show_bug.cgi?id=54873
+
+        * DumpRenderTree/chromium/LayoutTestController.h:
+        (LayoutTestController::setShouldDumpAsText):
+        (LayoutTestController::setShouldGeneratePixelResults):
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::runFileTest):
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (shouldDumpAsText):
+        (dump):
+        (runTest):
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (shouldDumpAsText):
+        (runTest):
+        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+        (WebCore::isDumpAsTextTest):
+        (WebCore::DumpRenderTree::open):
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (shouldDumpAsText):
+        (runTest):
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::dump):
+
 2011-02-22  Kenneth Russell  <kbr@google.com>
 
         Reviewed by James Robinson.
index 534a4ae..6150133 100644 (file)
@@ -343,6 +343,7 @@ public:
 
     WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*);
     bool shouldDumpAsText() { return m_dumpAsText; }
+    void setShouldDumpAsText(bool value) { m_dumpAsText = value; }
     bool shouldDumpEditingCallbacks() { return m_dumpEditingCallbacks; }
     bool shouldDumpFrameLoadCallbacks() { return m_dumpFrameLoadCallbacks; }
     void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }
@@ -358,6 +359,7 @@ public:
     bool shouldDumpChildFrameScrollPositions() { return m_dumpChildFrameScrollPositions; }
     bool shouldDumpChildFramesAsText() { return m_dumpChildFramesAsText; }
     bool shouldGeneratePixelResults() { return m_generatePixelResults; }
+    void setShouldGeneratePixelResults(bool value) { m_generatePixelResults = value; }
     bool acceptsEditing() { return m_acceptsEditing; }
     bool canOpenWindows() { return m_canOpenWindows; }
     bool shouldAddFileToPasteboard() { return m_shouldAddFileToPasteboard; }
index d888e7c..14f9ab8 100644 (file)
@@ -173,20 +173,21 @@ void TestShell::runFileTest(const TestParams& params)
     m_params = params;
     string testUrl = m_params.testUrl.spec();
 
-    bool inspectorTestMode = testUrl.find("/inspector/") != string::npos
-        || testUrl.find("\\inspector\\") != string::npos;
-
-    m_prefs.developerExtrasEnabled =  inspectorTestMode
-        || testUrl.find("/inspector-enabled/") != string::npos
-        || testUrl.find("\\inspector-enabled\\") != string::npos;
-
+    m_prefs.developerExtrasEnabled = true;
     applyPreferences();
 
     if (testUrl.find("loading/") != string::npos
         || testUrl.find("loading\\") != string::npos)
         m_layoutTestController->setShouldDumpFrameLoadCallbacks(true);
 
-    if (inspectorTestMode)
+    if (testUrl.find("/dumpAsText/") != string::npos
+        || testUrl.find("\\dumpAsText\\") != string::npos) {
+        m_layoutTestController->setShouldDumpAsText(true);
+        m_layoutTestController->setShouldGeneratePixelResults(false);
+    }
+
+    if (testUrl.find("/inspector/") != string::npos
+        || testUrl.find("\\inspector\\") != string::npos)
         showDevTools();
 
     if (m_dumpWhenFinished)
index 0fa5d10..ca62402 100644 (file)
@@ -105,6 +105,11 @@ static bool shouldOpenWebInspector(const string& pathOrURL)
     return pathOrURL.find("inspector/") != string::npos;
 }
 
+static bool shouldDumpAsText(const string& pathOrURL)
+{
+    return pathOrURL.find("dumpAsText/") != string::npos;
+}
+
 static bool shouldEnableDeveloperExtras(const string& pathOrURL)
 {
     return true;
@@ -513,7 +518,7 @@ void dump()
         gchar* responseMimeType = webkit_web_frame_get_response_mime_type(mainFrame);
 
         if (g_str_equal(responseMimeType, "text/plain")) {
-            gLayoutTestController->setDumpAsText(true);        
+            gLayoutTestController->setDumpAsText(true);
             gLayoutTestController->setGeneratePixelResults(false);
         }
         g_free(responseMimeType);
@@ -639,6 +644,10 @@ static void runTest(const string& testPathOrURL)
         gLayoutTestController->setDeveloperExtrasEnabled(true);
         if (shouldOpenWebInspector(testURL))
             gLayoutTestController->showWebInspector();
+        if (shouldDumpAsText(testURL)) {
+            gLayoutTestController->setDumpAsText(true);
+            gLayoutTestController->setGeneratePixelResults(false);
+        }
     }
 
     WorkQueue::shared()->clear();
index 8f011dd..49f58a2 100644 (file)
@@ -996,6 +996,11 @@ static bool shouldOpenWebInspector(const char* pathOrURL)
     return strstr(pathOrURL, "inspector/");
 }
 
+static bool shouldDumpAsText(const char* pathOrURL)
+{
+    return strstr(pathOrURL, "dumpAsText/");
+}
+
 static bool shouldEnableDeveloperExtras(const char* pathOrURL)
 {
     return true;
@@ -1090,6 +1095,10 @@ static void runTest(const string& testPathOrURL)
         gLayoutTestController->setDeveloperExtrasEnabled(true);
         if (shouldOpenWebInspector(pathOrURL.c_str()))
             gLayoutTestController->showWebInspector();
+        if (shouldDumpAsText(pathOrURL.c_str())) {
+            gLayoutTestController->setDumpAsText(true);
+            gLayoutTestController->setGeneratePixelResults(false);
+        }
     }
 
     if ([WebHistory optionalSharedHistory])
index 61b2a9b..490b1b8 100644 (file)
@@ -596,6 +596,14 @@ static bool isWebInspectorTest(const QUrl& url)
     return false;
 }
 
+static bool isDumpAsTextTest(const QUrl& url)
+{
+    if (url.path().contains("dumpAsText/"))
+        return true;
+    return false;
+}
+
+
 void DumpRenderTree::open(const QUrl& url)
 {
     DumpRenderTreeSupportQt::dumpResourceLoadCallbacksPath(QFileInfo(url.toString()).path());
@@ -607,6 +615,11 @@ void DumpRenderTree::open(const QUrl& url)
     if (isWebInspectorTest(url))
         layoutTestController()->showWebInspector();
 
+    if (isDumpAsTextTest(url)) {
+        layoutTestController()->dumpAsText();
+        setDumpPixels(false);
+    }
+
     if (isGlobalHistoryTest(url))
         layoutTestController()->dumpHistoryCallbacks();
 
index 335331f..002f4ae 100644 (file)
@@ -763,6 +763,11 @@ static bool shouldOpenWebInspector(const char* pathOrURL)
     return strstr(pathOrURL, "/inspector/") || strstr(pathOrURL, "\\inspector\\");
 }
 
+static bool shouldDumpAsText(const char* pathOrURL)
+{
+    return strstr(pathOrURL, "/dumpAsText/") || strstr(pathOrURL, "\\dumpAsText\\");
+}
+
 static bool shouldEnableDeveloperExtras(const char* pathOrURL)
 {
     return true;
@@ -958,6 +963,10 @@ static void runTest(const string& testPathOrURL)
         if (shouldOpenWebInspector(pathOrURL.c_str()))
             gLayoutTestController->showWebInspector();
     }
+    if (shouldDumpAsText(pathOrURL.c_str())) {
+        gLayoutTestController->setDumpAsText(true);
+        gLayoutTestController->setGeneratePixelResults(false);
+    }
 
     prevTestBFItem = 0;
     if (webView) {
index 739da3b..94de0d7 100644 (file)
@@ -493,6 +493,11 @@ void InjectedBundlePage::dump()
 
     InjectedBundle::shared().layoutTestController()->invalidateWaitToDumpWatchdogTimer();
 
+    WKBundleFrameRef frame = WKBundlePageGetMainFrame(m_page);
+    string url = toSTD(adoptWK(WKURLCopyString(adoptWK(WKBundleFrameCopyURL(frame)).get())));
+    if (strstr(url.c_str(), "dumpAsText/"))
+        InjectedBundle::shared().layoutTestController()->dumpAsText();
+
     switch (InjectedBundle::shared().layoutTestController()->whatToDump()) {
     case LayoutTestController::RenderTree: {
         WKRetainPtr<WKStringRef> text(AdoptWK, WKBundlePageCopyRenderTreeExternalRepresentation(m_page));