[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 14:58:01 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 9a67c3ab2a4b19671c132eb11da6497b033275a0
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 26 17:54:48 2010 +0000

    2010-10-26  Søren Gjesse  <sgjesse at chromium.org>
    
            Reviewed by Dimitri Glazkov.
    
            Added options --multiple-loads and --js-flags to chromium DumpRenderTree. The option --multiple-loads=X
            is used to have DumpRenderTree load each test it runs X times. To be able to have more fine-grained control
            of how the JavaScript engine behaves for each load the flag --js-flags can specify a list of flag-sets like this
    
              --js-flags="--xxx,--noxxx --yyy,--noyyy"
    
            First load will run with --xxx, the second with --yyy and the third without any (the 'no' prefix is handled by
            V8 to turn off the flag).
    
            The changes to the Python test runner will be in a separate change.
    
            * DumpRenderTree/chromium/DumpRenderTree.cpp:
            (runTest):
            (main):
            * DumpRenderTree/chromium/TestShell.cpp:
            (TestShell::TestShell):
            (TestShell::runFileTest):
            (TestShell::testFinished):
            * DumpRenderTree/chromium/TestShell.h:
            (TestShell::loadCount):
            (TestShell::setLoadCount):
            (TestShell::javaScriptFlagsForLoad):
            (TestShell::setJavaScriptFlags):
            (TestShell::setDumpWhenFinished):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70537 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index c8e7d1c..312ba81 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,33 @@
+2010-10-26  Søren Gjesse  <sgjesse at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Added options --multiple-loads and --js-flags to chromium DumpRenderTree. The option --multiple-loads=X
+        is used to have DumpRenderTree load each test it runs X times. To be able to have more fine-grained control
+        of how the JavaScript engine behaves for each load the flag --js-flags can specify a list of flag-sets like this
+
+          --js-flags="--xxx,--noxxx --yyy,--noyyy"
+
+        First load will run with --xxx, the second with --yyy and the third without any (the 'no' prefix is handled by
+        V8 to turn off the flag).
+
+        The changes to the Python test runner will be in a separate change.
+
+
+        * DumpRenderTree/chromium/DumpRenderTree.cpp:
+        (runTest):
+        (main):
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::TestShell):
+        (TestShell::runFileTest):
+        (TestShell::testFinished):
+        * DumpRenderTree/chromium/TestShell.h:
+        (TestShell::loadCount):
+        (TestShell::setLoadCount):
+        (TestShell::javaScriptFlagsForLoad):
+        (TestShell::setJavaScriptFlags):
+        (TestShell::setDumpWhenFinished):
+
 2010-10-26  Adam Roben  <aroben at apple.com>
 
         Skip more tests that depend on accelerated compositing when accelerated
diff --git a/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
index 72c0c3c..3bbba98 100644
--- a/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
@@ -32,6 +32,7 @@
 
 #include "TestShell.h"
 #include "webkit/support/webkit_support.h"
+#include <v8/include/v8.h>
 #include <wtf/Vector.h>
 
 using namespace std;
@@ -51,6 +52,9 @@ static const char optionCheckLayoutTestSystemDeps[] = "--check-layout-test-sys-d
 static const char optionEnableAcceleratedCompositing[] = "--enable-accelerated-compositing";
 static const char optionEnableAccelerated2DCanvas[] = "--enable-accelerated-2d-canvas";
 
+static const char optionMultipleLoads[] = "--multiple-loads=";
+static const char optionJavaScriptFlags[] = "--js-flags=";
+
 static void runTest(TestShell& shell, TestParams& params, const string& testName, bool testShellMode)
 {
     int oldTimeoutMsec = shell.layoutTestTimeout();
@@ -78,8 +82,14 @@ static void runTest(TestShell& shell, TestParams& params, const string& testName
     }
     params.testUrl = webkit_support::CreateURLForPathOrURL(pathOrURL);
     webkit_support::SetCurrentDirectoryForFileURL(params.testUrl);
-    shell.resetTestController();
-    shell.runFileTest(params);
+    for (int i = 0; i < shell.loadCount(); i++) {
+        string javaScriptFlags = shell.javaScriptFlagsForLoad(i);
+        v8::V8::SetFlagsFromString(javaScriptFlags.data(), static_cast<int>(javaScriptFlags.size()));
+        bool isLastLoad = (i == (shell.loadCount() - 1));
+        shell.setDumpWhenFinished(isLastLoad);
+        shell.resetTestController();
+        shell.runFileTest(params);
+    }
     shell.setLayoutTestTimeout(oldTimeoutMsec);
 }
 
@@ -96,6 +106,8 @@ int main(int argc, char* argv[])
     bool startupDialog = false;
     bool acceleratedCompositingEnabled = false;
     bool accelerated2DCanvasEnabled = false;
+    int loadCount = 1;
+    string javaScriptFlags;
     for (int i = 1; i < argc; ++i) {
         string argument(argv[i]);
         if (argument == "-")
@@ -120,7 +132,12 @@ int main(int argc, char* argv[])
             acceleratedCompositingEnabled = true;
         else if (argument == optionEnableAccelerated2DCanvas)
             accelerated2DCanvasEnabled = true;
-        else if (argument.size() && argument[0] == '-')
+        else if (!argument.find(optionMultipleLoads)) {
+            string multipleLoadsStr = argument.substr(strlen(optionMultipleLoads));
+            loadCount = atoi(multipleLoadsStr.c_str());
+        } else if (!argument.find(optionJavaScriptFlags)) {
+            javaScriptFlags = argument.substr(strlen(optionJavaScriptFlags));
+        } else if (argument.size() && argument[0] == '-')
             fprintf(stderr, "Unknown option: %s\n", argv[i]);
         else
             tests.append(argument);
@@ -129,6 +146,30 @@ int main(int argc, char* argv[])
         fprintf(stderr, "--pixel-tests with --test-shell requires a file name.\n");
         return EXIT_FAILURE;
     }
+    if (loadCount < 1) {
+        fprintf(stderr, "--multiple-loads requires a positive numeric argument.\n");
+        return EXIT_FAILURE;
+    }
+
+    // The test runner might send a quoted string which needs to be unquoted before further processing.
+    if (javaScriptFlags.length() > 1 && javaScriptFlags[0] == '"' && javaScriptFlags[javaScriptFlags.length() - 1] == '"')
+        javaScriptFlags = javaScriptFlags.substr(1, javaScriptFlags.length() - 2);
+    // Split the JavaScript flags into a list.
+    Vector<string> flagsList;
+    size_t start = 0;
+    while (true) {
+        size_t commaPos = javaScriptFlags.find_first_of(',', start);
+        string flags;
+        if (commaPos == string::npos)
+            flags = javaScriptFlags.substr(start, javaScriptFlags.length() - start);
+        else {
+            flags = javaScriptFlags.substr(start, commaPos - start);
+            start = commaPos + 1;
+        }
+        flagsList.append(flags);
+        if (commaPos == string::npos)
+            break;
+    }
 
     if (startupDialog)
         openStartupDialog();
@@ -138,6 +179,8 @@ int main(int argc, char* argv[])
         shell.setAllowExternalPages(allowExternalPages);
         shell.setAcceleratedCompositingEnabled(acceleratedCompositingEnabled);
         shell.setAccelerated2dCanvasEnabled(accelerated2DCanvasEnabled);
+        shell.setLoadCount(loadCount);
+        shell.setJavaScriptFlags(flagsList);
         if (serverMode && !tests.size()) {
             params.printSeparators = true;
             char testString[2048]; // 2048 is the same as the sizes of other platforms.
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.cpp b/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
index 0b27c78..250473b 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
@@ -86,6 +86,8 @@ TestShell::TestShell(bool testShellMode)
     , m_allowExternalPages(false)
     , m_acceleratedCompositingEnabled(false)
     , m_accelerated2dCanvasEnabled(false)
+    , m_loadCount(1)
+    , m_dumpWhenFinished(true)
 {
     WebRuntimeFeatures::enableGeolocation(true);
     WebRuntimeFeatures::enableIndexedDatabase(true);
@@ -181,7 +183,8 @@ void TestShell::runFileTest(const TestParams& params)
     if (inspectorTestMode)
         showDevTools();
 
-    m_printer->handleTestHeader(testUrl.c_str());
+    if (m_dumpWhenFinished)
+        m_printer->handleTestHeader(testUrl.c_str());
     loadURL(m_params.testUrl);
 
     m_testIsPreparing = false;
@@ -270,7 +273,8 @@ void TestShell::testFinished()
     if (!m_testIsPending)
         return;
     m_testIsPending = false;
-    dump();
+    if (m_dumpWhenFinished)
+        dump();
     webkit_support::QuitMessageLoop();
 }
 
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.h b/WebKitTools/DumpRenderTree/chromium/TestShell.h
index d8e9c69..ca06812 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShell.h
+++ b/WebKitTools/DumpRenderTree/chromium/TestShell.h
@@ -67,7 +67,7 @@ struct TestParams {
     bool dumpPixels;
     bool printSeparators;
     WebKit::WebURL testUrl;
-    // Resultant image file name. Reqruired only if the test_shell mode.
+    // Resultant image file name. Required only if the test_shell mode.
     std::string pixelFileName;
     std::string pixelHash;
 
@@ -137,6 +137,20 @@ public:
     int layoutTestTimeoutForWatchDog() { return layoutTestTimeout() + 1000; }
     void setLayoutTestTimeout(int timeout) { m_timeout = timeout; }
 
+    // Number of times to load each URL.
+    int loadCount() { return m_loadCount; }
+    void setLoadCount(int loadCount) { m_loadCount = loadCount; }
+
+    // The JavaScript flags are specified as a vector of strings. Each element of the vector is full flags string
+    // which can contain multiple flags (e.g. "--xxx --yyy"). With multiple load testing it is possible to specify
+    // separate sets of flags to each load.
+    std::string javaScriptFlagsForLoad(size_t load) { return (load >= 0 && load < m_javaScriptFlags.size()) ? m_javaScriptFlags[load] : ""; }
+    void setJavaScriptFlags(Vector<std::string> javaScriptFlags) { m_javaScriptFlags = javaScriptFlags; }
+
+    // Set whether to dump when the loaded page has finished processing. This is used with multiple load
+    // testing where we only want to have the output from the last load.
+    void setDumpWhenFinished(bool dumpWhenFinished) { m_dumpWhenFinished = dumpWhenFinished; }
+
     WebViewHost* createWebView();
     WebViewHost* createNewWindow(const WebKit::WebURL&);
     void closeWindow(WebViewHost*);
@@ -183,6 +197,10 @@ private:
     bool m_acceleratedCompositingEnabled;
     bool m_accelerated2dCanvasEnabled;
     WebPreferences m_prefs;
+    int m_loadCount;
+    Vector<std::string> m_javaScriptFlags;
+    bool m_dumpWhenFinished;
+
 
     // List of all windows in this process.
     // The main window should be put into windowList[0].

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list