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

jocelyn.turcotte at nokia.com jocelyn.turcotte at nokia.com
Wed Dec 22 13:36:31 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 84ff9adad33c32fc33901fa23cbbf9db94593779
Author: jocelyn.turcotte at nokia.com <jocelyn.turcotte at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 21 11:25:54 2010 +0000

    [Qt] Add robot loader timeout and extra time options.
    https://bugs.webkit.org/show_bug.cgi?id=46172
    
    Reviewed by Andreas Kling.
    
    [-robot-timeout <s>]: Load the next page after s seconds if the current
    page didn't finish loading.
    [-robot-extra-time <s>]: Wait s seconds after the current page finished
    loading before loading the next one. This should allow some time for the
    page's JavaScript to execute.
    
    * QtTestBrowser/launcherwindow.cpp:
    (LauncherWindow::applyPrefs):
    * QtTestBrowser/main.cpp:
    (LauncherApplication::robotTimeout):
    (LauncherApplication::robotExtraTime):
    (LauncherApplication::LauncherApplication):
    (LauncherApplication::handleUserOptions):
    (main):
    * QtTestBrowser/urlloader.cpp:
    (UrlLoader::UrlLoader):
    (UrlLoader::loadNext):
    (UrlLoader::loadUrlList):
    * QtTestBrowser/urlloader.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67942 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index ccb8d01..ee76358 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,30 @@
+2010-09-21  Jocelyn Turcotte  <jocelyn.turcotte at nokia.com>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] Add robot loader timeout and extra time options.
+        https://bugs.webkit.org/show_bug.cgi?id=46172
+
+        [-robot-timeout <s>]: Load the next page after s seconds if the current
+        page didn't finish loading.
+        [-robot-extra-time <s>]: Wait s seconds after the current page finished
+        loading before loading the next one. This should allow some time for the
+        page's JavaScript to execute.
+
+        * QtTestBrowser/launcherwindow.cpp:
+        (LauncherWindow::applyPrefs):
+        * QtTestBrowser/main.cpp:
+        (LauncherApplication::robotTimeout):
+        (LauncherApplication::robotExtraTime):
+        (LauncherApplication::LauncherApplication):
+        (LauncherApplication::handleUserOptions):
+        (main):
+        * QtTestBrowser/urlloader.cpp:
+        (UrlLoader::UrlLoader):
+        (UrlLoader::loadNext):
+        (UrlLoader::loadUrlList):
+        * QtTestBrowser/urlloader.h:
+
 2010-09-21  Pavel Podivilov  <podivilov at chromium.org>
 
         Unreviewed.
diff --git a/WebKitTools/QtTestBrowser/main.cpp b/WebKitTools/QtTestBrowser/main.cpp
index ec864e9..e0c6e7d 100644
--- a/WebKitTools/QtTestBrowser/main.cpp
+++ b/WebKitTools/QtTestBrowser/main.cpp
@@ -54,6 +54,8 @@ public:
     LauncherApplication(int& argc, char** argv);
     QStringList urls() const { return m_urls; }
     bool isRobotized() const { return m_isRobotized; }
+    int robotTimeout() const { return m_robotTimeoutSeconds; }
+    int robotExtraTime() const { return m_robotExtraTimeSeconds; }
 
 private:
     void handleUserOptions();
@@ -61,6 +63,8 @@ private:
 
 private:
     bool m_isRobotized;
+    int m_robotTimeoutSeconds;
+    int m_robotExtraTimeSeconds;
     QStringList m_urls;
 };
 
@@ -78,6 +82,8 @@ void LauncherApplication::applyDefaultSettings()
 LauncherApplication::LauncherApplication(int& argc, char** argv)
     : QApplication(argc, argv, QApplication::GuiServer)
     , m_isRobotized(false)
+    , m_robotTimeoutSeconds(0)
+    , m_robotExtraTimeSeconds(0)
 {
     // To allow QWebInspector's configuration persistence
     setOrganizationName("Nokia");
@@ -115,6 +121,8 @@ void LauncherApplication::handleUserOptions()
              << "[-cache-webview]"
              << "[-show-fps]"
              << "[-r list]"
+             << "[-robot-timeout seconds]"
+             << "[-robot-extra-time seconds]"
              << "[-inspector-url location]"
              << "[-tiled-backing-store]"
              << "[-resizes-to-contents]"
@@ -190,11 +198,18 @@ void LauncherApplication::handleUserOptions()
 
         m_isRobotized = true;
         m_urls = QStringList(listFile);
-        return;
+    } else {
+        int lastArg = args.lastIndexOf(QRegExp("^-.*"));
+        m_urls = (lastArg != -1) ? args.mid(++lastArg) : args.mid(1);
     }
 
-    int lastArg = args.lastIndexOf(QRegExp("^-.*"));
-    m_urls = (lastArg != -1) ? args.mid(++lastArg) : args.mid(1);
+    int robotTimeoutIndex = args.indexOf("-robot-timeout");
+    if (robotTimeoutIndex != -1)
+        m_robotTimeoutSeconds = takeOptionValue(&args, robotTimeoutIndex).toInt();
+
+    int robotExtraTimeIndex = args.indexOf("-robot-extra-time");
+    if (robotExtraTimeIndex != -1)
+        m_robotExtraTimeSeconds = takeOptionValue(&args, robotExtraTimeIndex).toInt();
 }
 
 
@@ -204,8 +219,7 @@ int main(int argc, char **argv)
 
     if (app.isRobotized()) {
         LauncherWindow* window = new LauncherWindow();
-        UrlLoader loader(window->page()->mainFrame(), app.urls().at(0));
-        QObject::connect(window->page()->mainFrame(), SIGNAL(loadFinished(bool)), &loader, SLOT(loadNext()));
+        UrlLoader loader(window->page()->mainFrame(), app.urls().at(0), app.robotTimeout(), app.robotExtraTime());
         loader.loadNext();
         window->show();
         return launcherMain(app);
diff --git a/WebKitTools/QtTestBrowser/urlloader.cpp b/WebKitTools/QtTestBrowser/urlloader.cpp
index 630ead6..abe9902 100644
--- a/WebKitTools/QtTestBrowser/urlloader.cpp
+++ b/WebKitTools/QtTestBrowser/urlloader.cpp
@@ -31,16 +31,31 @@
 #include <QFile>
 #include <QDebug>
 
-UrlLoader::UrlLoader(QWebFrame* frame, const QString& inputFileName)
+UrlLoader::UrlLoader(QWebFrame* frame, const QString& inputFileName, int timeoutSeconds, int extraTimeSeconds)
     : m_frame(frame)
     , m_stdOut(stdout)
     , m_loaded(0)
 {
-    init(inputFileName);
+    if (timeoutSeconds) {
+        m_timeoutTimer.setInterval(timeoutSeconds * 1000);
+        m_timeoutTimer.setSingleShot(true);
+        connect(frame, SIGNAL(loadStarted()), &m_timeoutTimer, SLOT(start()));
+        connect(&m_timeoutTimer, SIGNAL(timeout()), this, SLOT(loadNext()));
+    }
+    if (extraTimeSeconds) {
+        m_extraTimeTimer.setInterval(extraTimeSeconds * 1000);
+        m_extraTimeTimer.setSingleShot(true);
+        connect(frame, SIGNAL(loadFinished(bool)), &m_extraTimeTimer, SLOT(start()));
+        connect(&m_extraTimeTimer, SIGNAL(timeout()), this, SLOT(loadNext()));
+    } else
+        connect(frame, SIGNAL(loadFinished(bool)), this, SLOT(loadNext()));
+    loadUrlList(inputFileName);
 }
 
 void UrlLoader::loadNext()
 {
+    m_timeoutTimer.stop();
+    m_extraTimeTimer.stop();
     QString qstr;
     if (getUrl(qstr)) {
         QUrl url(qstr, QUrl::StrictMode);
@@ -53,7 +68,7 @@ void UrlLoader::loadNext()
         disconnect(m_frame, 0, this, 0);
 }
 
-void UrlLoader::init(const QString& inputFileName)
+void UrlLoader::loadUrlList(const QString& inputFileName)
 {
     QFile inputFile(inputFileName);
     if (inputFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
diff --git a/WebKitTools/QtTestBrowser/urlloader.h b/WebKitTools/QtTestBrowser/urlloader.h
index ed14adc..e2a6d87 100644
--- a/WebKitTools/QtTestBrowser/urlloader.h
+++ b/WebKitTools/QtTestBrowser/urlloader.h
@@ -32,19 +32,20 @@
 #include "qwebframe.h"
 
 #include <QTextStream>
+#include <QTimer>
 #include <QVector>
 
 class UrlLoader : public QObject {
     Q_OBJECT
 
 public:
-    UrlLoader(QWebFrame* frame, const QString& inputFileName);
+    UrlLoader(QWebFrame* frame, const QString& inputFileName, int timeoutSeconds, int extraTimeSeconds);
 
 public slots:
     void loadNext();
 
 private:
-    void init(const QString& inputFileName);
+    void loadUrlList(const QString& inputFileName);
     bool getUrl(QString& qstr);
 
 private:
@@ -53,6 +54,8 @@ private:
     QWebFrame* m_frame;
     QTextStream m_stdOut;
     int m_loaded;
+    QTimer m_timeoutTimer;
+    QTimer m_extraTimeTimer;
 };
 
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list