Changeset 67942 in webkit
- Timestamp:
- Sep 21, 2010 4:25:54 AM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r67934 r67942 1 2010-09-21 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> 2 3 Reviewed by Andreas Kling. 4 5 [Qt] Add robot loader timeout and extra time options. 6 https://bugs.webkit.org/show_bug.cgi?id=46172 7 8 [-robot-timeout <s>]: Load the next page after s seconds if the current 9 page didn't finish loading. 10 [-robot-extra-time <s>]: Wait s seconds after the current page finished 11 loading before loading the next one. This should allow some time for the 12 page's JavaScript to execute. 13 14 * QtTestBrowser/launcherwindow.cpp: 15 (LauncherWindow::applyPrefs): 16 * QtTestBrowser/main.cpp: 17 (LauncherApplication::robotTimeout): 18 (LauncherApplication::robotExtraTime): 19 (LauncherApplication::LauncherApplication): 20 (LauncherApplication::handleUserOptions): 21 (main): 22 * QtTestBrowser/urlloader.cpp: 23 (UrlLoader::UrlLoader): 24 (UrlLoader::loadNext): 25 (UrlLoader::loadUrlList): 26 * QtTestBrowser/urlloader.h: 27 1 28 2010-09-21 Pavel Podivilov <podivilov@chromium.org> 2 29 -
trunk/WebKitTools/QtTestBrowser/main.cpp
r65792 r67942 55 55 QStringList urls() const { return m_urls; } 56 56 bool isRobotized() const { return m_isRobotized; } 57 int robotTimeout() const { return m_robotTimeoutSeconds; } 58 int robotExtraTime() const { return m_robotExtraTimeSeconds; } 57 59 58 60 private: … … 62 64 private: 63 65 bool m_isRobotized; 66 int m_robotTimeoutSeconds; 67 int m_robotExtraTimeSeconds; 64 68 QStringList m_urls; 65 69 }; … … 79 83 : QApplication(argc, argv, QApplication::GuiServer) 80 84 , m_isRobotized(false) 85 , m_robotTimeoutSeconds(0) 86 , m_robotExtraTimeSeconds(0) 81 87 { 82 88 // To allow QWebInspector's configuration persistence … … 116 122 << "[-show-fps]" 117 123 << "[-r list]" 124 << "[-robot-timeout seconds]" 125 << "[-robot-extra-time seconds]" 118 126 << "[-inspector-url location]" 119 127 << "[-tiled-backing-store]" … … 191 199 m_isRobotized = true; 192 200 m_urls = QStringList(listFile); 193 return; 194 } 195 196 int lastArg = args.lastIndexOf(QRegExp("^-.*")); 197 m_urls = (lastArg != -1) ? args.mid(++lastArg) : args.mid(1); 201 } else { 202 int lastArg = args.lastIndexOf(QRegExp("^-.*")); 203 m_urls = (lastArg != -1) ? args.mid(++lastArg) : args.mid(1); 204 } 205 206 int robotTimeoutIndex = args.indexOf("-robot-timeout"); 207 if (robotTimeoutIndex != -1) 208 m_robotTimeoutSeconds = takeOptionValue(&args, robotTimeoutIndex).toInt(); 209 210 int robotExtraTimeIndex = args.indexOf("-robot-extra-time"); 211 if (robotExtraTimeIndex != -1) 212 m_robotExtraTimeSeconds = takeOptionValue(&args, robotExtraTimeIndex).toInt(); 198 213 } 199 214 … … 205 220 if (app.isRobotized()) { 206 221 LauncherWindow* window = new LauncherWindow(); 207 UrlLoader loader(window->page()->mainFrame(), app.urls().at(0)); 208 QObject::connect(window->page()->mainFrame(), SIGNAL(loadFinished(bool)), &loader, SLOT(loadNext())); 222 UrlLoader loader(window->page()->mainFrame(), app.urls().at(0), app.robotTimeout(), app.robotExtraTime()); 209 223 loader.loadNext(); 210 224 window->show(); -
trunk/WebKitTools/QtTestBrowser/urlloader.cpp
r53862 r67942 32 32 #include <QDebug> 33 33 34 UrlLoader::UrlLoader(QWebFrame* frame, const QString& inputFileName )34 UrlLoader::UrlLoader(QWebFrame* frame, const QString& inputFileName, int timeoutSeconds, int extraTimeSeconds) 35 35 : m_frame(frame) 36 36 , m_stdOut(stdout) 37 37 , m_loaded(0) 38 38 { 39 init(inputFileName); 39 if (timeoutSeconds) { 40 m_timeoutTimer.setInterval(timeoutSeconds * 1000); 41 m_timeoutTimer.setSingleShot(true); 42 connect(frame, SIGNAL(loadStarted()), &m_timeoutTimer, SLOT(start())); 43 connect(&m_timeoutTimer, SIGNAL(timeout()), this, SLOT(loadNext())); 44 } 45 if (extraTimeSeconds) { 46 m_extraTimeTimer.setInterval(extraTimeSeconds * 1000); 47 m_extraTimeTimer.setSingleShot(true); 48 connect(frame, SIGNAL(loadFinished(bool)), &m_extraTimeTimer, SLOT(start())); 49 connect(&m_extraTimeTimer, SIGNAL(timeout()), this, SLOT(loadNext())); 50 } else 51 connect(frame, SIGNAL(loadFinished(bool)), this, SLOT(loadNext())); 52 loadUrlList(inputFileName); 40 53 } 41 54 42 55 void UrlLoader::loadNext() 43 56 { 57 m_timeoutTimer.stop(); 58 m_extraTimeTimer.stop(); 44 59 QString qstr; 45 60 if (getUrl(qstr)) { … … 54 69 } 55 70 56 void UrlLoader:: init(const QString& inputFileName)71 void UrlLoader::loadUrlList(const QString& inputFileName) 57 72 { 58 73 QFile inputFile(inputFileName); -
trunk/WebKitTools/QtTestBrowser/urlloader.h
r53862 r67942 33 33 34 34 #include <QTextStream> 35 #include <QTimer> 35 36 #include <QVector> 36 37 … … 39 40 40 41 public: 41 UrlLoader(QWebFrame* frame, const QString& inputFileName );42 UrlLoader(QWebFrame* frame, const QString& inputFileName, int timeoutSeconds, int extraTimeSeconds); 42 43 43 44 public slots: … … 45 46 46 47 private: 47 void init(const QString& inputFileName);48 void loadUrlList(const QString& inputFileName); 48 49 bool getUrl(QString& qstr); 49 50 … … 54 55 QTextStream m_stdOut; 55 56 int m_loaded; 57 QTimer m_timeoutTimer; 58 QTimer m_extraTimeTimer; 56 59 }; 57 60
Note: See TracChangeset
for help on using the changeset viewer.