[Qt][DRT] DumpRenderTreeQt should support --no-timeout and --timeout options
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2012 04:04:54 +0000 (04:04 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2012 04:04:54 +0000 (04:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78146

Patch by Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> on 2012-02-08
Reviewed by Ryosuke Niwa.

Our DumpRenderTree should support --no-timeout and --timeout options in order
to be able to use run-perf-tests and have a Performance Bot.
This patch adds setTimeout and setShouldTimeout functions to our LayoutTestController
and the necessary code to handle such command line arguments to our DumpRenderTree.

* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
(WebCore::DumpRenderTree::setTimeout):
(WebCore):
(WebCore::DumpRenderTree::setShouldTimeout):
* DumpRenderTree/qt/DumpRenderTreeQt.h:
(DumpRenderTree):
* DumpRenderTree/qt/LayoutTestControllerQt.cpp:
(LayoutTestController::LayoutTestController):
(LayoutTestController::waitUntilDone):
(LayoutTestController::notifyDone):
* DumpRenderTree/qt/LayoutTestControllerQt.h:
(LayoutTestController::setTimeout):
(LayoutTestController::setShouldTimeout):
(LayoutTestController):
* DumpRenderTree/qt/main.cpp:
(isOption):
(printUsage):
(main):

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

Tools/ChangeLog
Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
Tools/DumpRenderTree/qt/DumpRenderTreeQt.h
Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
Tools/DumpRenderTree/qt/LayoutTestControllerQt.h
Tools/DumpRenderTree/qt/main.cpp

index 359547c..2958533 100644 (file)
@@ -1,3 +1,34 @@
+2012-02-08  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
+
+        [Qt][DRT] DumpRenderTreeQt should support --no-timeout and --timeout options
+        https://bugs.webkit.org/show_bug.cgi?id=78146
+
+        Reviewed by Ryosuke Niwa.
+
+        Our DumpRenderTree should support --no-timeout and --timeout options in order
+        to be able to use run-perf-tests and have a Performance Bot.
+        This patch adds setTimeout and setShouldTimeout functions to our LayoutTestController
+        and the necessary code to handle such command line arguments to our DumpRenderTree.
+
+        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+        (WebCore::DumpRenderTree::setTimeout):
+        (WebCore):
+        (WebCore::DumpRenderTree::setShouldTimeout):
+        * DumpRenderTree/qt/DumpRenderTreeQt.h:
+        (DumpRenderTree):
+        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+        (LayoutTestController::LayoutTestController):
+        (LayoutTestController::waitUntilDone):
+        (LayoutTestController::notifyDone):
+        * DumpRenderTree/qt/LayoutTestControllerQt.h:
+        (LayoutTestController::setTimeout):
+        (LayoutTestController::setShouldTimeout):
+        (LayoutTestController):
+        * DumpRenderTree/qt/main.cpp:
+        (isOption):
+        (printUsage):
+        (main):
+
 2012-02-08  Gustavo Noronha Silva  <gns@gnome.org>
 
         Rubber-stamped by Martin Robinson.
index 21da8d0..d546386 100644 (file)
@@ -1138,4 +1138,14 @@ QList<WebPage*> DumpRenderTree::getAllPages() const
     return pages;
 }
 
+void DumpRenderTree::setTimeout(int timeout)
+{
+    m_controller->setTimeout(timeout);
+}
+
+void DumpRenderTree::setShouldTimeout(bool flag)
+{
+    m_controller->setShouldTimeout(flag);
+}
+
 }
index 5e1d6b4..1de1cb9 100644 (file)
@@ -106,6 +106,9 @@ public:
     void setRedirectOutputFileName(const QString& fileName) { m_redirectOutputFileName = fileName; }
     void setRedirectErrorFileName(const QString& fileName) { m_redirectErrorFileName = fileName; }
 
+    void setTimeout(int);
+    void setShouldTimeout(bool flag);
+
 public Q_SLOTS:
     void initJSObjects();
 
index 722bf77..0376680 100644 (file)
@@ -41,6 +41,8 @@
 LayoutTestController::LayoutTestController(WebCore::DumpRenderTree* drt)
     : QObject()
     , m_drt(drt)
+    , m_shouldTimeout(true)
+    , m_timeout(30000)
 {
     reset();
     DumpRenderTreeSupportQt::dumpNotification(true);
@@ -146,7 +148,11 @@ void LayoutTestController::waitUntilDone()
 {
     //qDebug() << ">>>>waitForDone";
     m_waitForDone = true;
-    m_timeoutTimer.start(30000, this);
+
+    if (!m_shouldTimeout)
+        return;
+
+    m_timeoutTimer.start(m_timeout, this);
 }
 
 QString LayoutTestController::counterValueForElementById(const QString& id)
@@ -178,7 +184,7 @@ void LayoutTestController::notifyDone()
 {
     qDebug() << ">>>>notifyDone";
 
-    if (!m_timeoutTimer.isActive())
+    if (m_shouldTimeout && !m_timeoutTimer.isActive())
         return;
 
     m_timeoutTimer.stop();
index a543e45..8c5d6e2 100644 (file)
@@ -80,6 +80,9 @@ public:
     static const unsigned int maxViewWidth;
     static const unsigned int maxViewHeight;
 
+    void setTimeout(int timeout) { m_timeout = timeout; }
+    void setShouldTimeout(bool flag) { m_shouldTimeout = flag; }
+
 protected:
     void timerEvent(QTimerEvent*);
 
@@ -317,6 +320,9 @@ private:
     QWebHistory* m_webHistory;
     QStringList m_desktopNotificationAllowedOrigins;
     bool m_ignoreDesktopNotification;
+
+    bool m_shouldTimeout;
+    int m_timeout;
 };
 
 #endif // LayoutTestControllerQt_h
index 2f83cae..b562108 100644 (file)
@@ -73,6 +73,7 @@ bool isOption(const QString& str)
 {
     return str == QString("-v") || str == QString("--pixel-tests")
            || str == QString("--stdout") || str == QString("--stderr")
+           || str == QString("--timeout") || str == QString("--no-timeout")
            || str == QString("-");
 }
 
@@ -89,7 +90,7 @@ QString takeOptionValue(QStringList& arguments, int index)
 
 void printUsage()
 {
-    fprintf(stderr, "Usage: DumpRenderTree [-v|--pixel-tests] [--stdout output_filename] [-stderr error_filename] filename [filename2..n]\n");
+    fprintf(stderr, "Usage: DumpRenderTree [-v|--pixel-tests] [--stdout output_filename] [-stderr error_filename] [--no-timeout] [--timeout timeout_MS] filename [filename2..n]\n");
     fprintf(stderr, "Or folder containing test files: DumpRenderTree [-v|--pixel-tests] dirpath\n");
     fflush(stderr);
 }
@@ -213,6 +214,19 @@ int main(int argc, char* argv[])
     }
     QWebDatabase::removeAllDatabases();
 
+    index = args.indexOf(QLatin1String("--timeout"));
+    if (index != -1) {
+        int timeout = takeOptionValue(args, index).toInt();
+        dumper.setTimeout(timeout);
+        args.removeAt(index);
+    }
+
+    index = args.indexOf(QLatin1String("--no-timeout"));
+    if (index != -1) {
+        dumper.setShouldTimeout(false);
+        args.removeAt(index);
+    }
+
     index = args.indexOf(QLatin1String("-"));
     if (index != -1) {
         args.removeAt(index);