[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
vestbo at webkit.org
vestbo at webkit.org
Thu Feb 4 21:21:17 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit c43071f16f1e8318bd5559b1cfa2deee48d91543
Author: vestbo at webkit.org <vestbo at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jan 20 08:20:59 2010 +0000
[Qt] Don't use QSocketNotifier in the DRT for reading stdin
Reviewed by Simon Hausmann.
QSocketNotifier is not available on Windows. Instead we read
stdin synchronously after each test using signals and slots.
* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
* DumpRenderTree/qt/DumpRenderTreeQt.h:
* DumpRenderTree/qt/main.cpp:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53526 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index e705fa1..967aca6 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,16 @@
+2010-01-19 Tor Arne Vestbø <tor.arne.vestbo at nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Don't use QSocketNotifier in the DRT for reading stdin
+
+ QSocketNotifier is not available on Windows. Instead we read
+ stdin synchronously after each test using signals and slots.
+
+ * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+ * DumpRenderTree/qt/DumpRenderTreeQt.h:
+ * DumpRenderTree/qt/main.cpp:
+
2010-01-19 Adam Barth <abarth at webkit.org>
Rubber stamped by Eric Seidel.
diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
index 52939e4..37ff6c0 100644
--- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
@@ -310,8 +310,8 @@ QObject* WebPage::createPlugin(const QString& classId, const QUrl& url, const QS
DumpRenderTree::DumpRenderTree()
: m_dumpPixels(false)
, m_stdin(0)
- , m_notifier(0)
, m_enableTextOutput(false)
+ , m_singleFileMode(false)
{
qt_drt_overwritePluginDirectories();
QWebSettings::enablePersistentStorage();
@@ -359,20 +359,6 @@ DumpRenderTree::~DumpRenderTree()
{
delete m_mainView;
delete m_stdin;
- delete m_notifier;
-}
-
-void DumpRenderTree::open()
-{
- if (!m_stdin) {
- m_stdin = new QFile;
- m_stdin->open(stdin, QFile::ReadOnly);
- }
-
- if (!m_notifier) {
- m_notifier = new QSocketNotifier(STDIN_FILENO, QSocketNotifier::Read);
- connect(m_notifier, SIGNAL(activated(int)), this, SLOT(readStdin(int)));
- }
}
static void clearHistory(QWebPage* page)
@@ -458,20 +444,59 @@ void DumpRenderTree::open(const QUrl& aurl)
m_page->mainFrame()->load(url);
}
-void DumpRenderTree::readStdin(int /* socket */)
+void DumpRenderTree::readLine()
{
- // Read incoming data from stdin...
- QByteArray line = m_stdin->readLine();
- if (line.endsWith('\n'))
- line.truncate(line.size()-1);
- //fprintf(stderr, "\n opening %s\n", line.constData());
- if (line.isEmpty())
- quit();
+ if (!m_stdin) {
+ m_stdin = new QFile;
+ m_stdin->open(stdin, QFile::ReadOnly);
+
+ if (!m_stdin->isReadable()) {
+ emit quit();
+ return;
+ }
+ }
- if (line.startsWith("http:") || line.startsWith("https:"))
+ QByteArray line = m_stdin->readLine().trimmed();
+
+ if (line.isEmpty()) {
+ emit quit();
+ return;
+ }
+
+ processLine(QString::fromLocal8Bit(line.constData(), line.length()));
+}
+
+void DumpRenderTree::processLine(const QString &input)
+{
+ QString line = input;
+
+ if (line.startsWith(QLatin1String("http:"))
+ || line.startsWith(QLatin1String("https:"))
+ || line.startsWith(QLatin1String("file:"))) {
open(QUrl(line));
- else {
+ } else {
QFileInfo fi(line);
+
+ if (!fi.exists()) {
+ QDir currentDir = QDir::currentPath();
+
+ // Try to be smart about where the test is located
+ if (currentDir.dirName() == QLatin1String("LayoutTests"))
+ fi = QFileInfo(currentDir, line.replace(QRegExp(".*?LayoutTests/(.*)"), "\\1"));
+ else if (!line.contains(QLatin1String("LayoutTests")))
+ fi = QFileInfo(currentDir, line.prepend(QLatin1String("LayoutTests/")));
+
+ if (!fi.exists()) {
+ if (isSingleFileMode())
+ emit quit();
+ else
+ emit ready();
+
+ return;
+ }
+
+ }
+
open(QUrl::fromLocalFile(fi.absoluteFilePath()));
}
@@ -617,9 +642,7 @@ void DumpRenderTree::dump()
QWebFrame *mainFrame = m_page->mainFrame();
- //fprintf(stderr, " Dumping\n");
- if (!m_notifier) {
- // Dump markup in single file mode...
+ if (isSingleFileMode()) {
QString markup = mainFrame->toHtml();
fprintf(stdout, "Source:\n\n%s\n", markup.toUtf8().constData());
}
@@ -697,8 +720,10 @@ void DumpRenderTree::dump()
fflush(stdout);
fflush(stderr);
- if (!m_notifier)
- quit(); // Exit now in single file mode...
+ if (isSingleFileMode())
+ emit quit();
+ else
+ emit ready();
}
void DumpRenderTree::titleChanged(const QString &s)
diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h
index caee52d..bc63ca5 100644
--- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h
+++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h
@@ -68,15 +68,15 @@ public:
DumpRenderTree();
virtual ~DumpRenderTree();
- // Initialize in multi-file mode, used by run-webkit-tests.
- void open();
-
// Initialize in single-file mode.
void open(const QUrl& url);
void setTextOutputEnabled(bool enable) { m_enableTextOutput = enable; }
bool isTextOutputEnabled() { return m_enableTextOutput; }
+ void setSingleFileMode(bool flag) { m_singleFileMode = flag; }
+ bool isSingleFileMode() { return m_singleFileMode; }
+
void setDumpPixels(bool);
void closeRemainingWindows();
@@ -100,7 +100,10 @@ public:
public Q_SLOTS:
void initJSObjects();
- void readStdin(int);
+
+ void readLine();
+ void processLine(const QString&);
+
void dump();
void titleChanged(const QString &s);
void connectFrame(QWebFrame *frame);
@@ -109,6 +112,7 @@ public Q_SLOTS:
Q_SIGNALS:
void quit();
+ void ready();
private:
QString dumpFramesAsText(QWebFrame* frame);
@@ -126,10 +130,10 @@ private:
GCController* m_gcController;
QFile *m_stdin;
- QSocketNotifier* m_notifier;
QList<QObject*> windows;
bool m_enableTextOutput;
+ bool m_singleFileMode;
};
class NetworkAccessManager : public QNetworkAccessManager {
diff --git a/WebKitTools/DumpRenderTree/qt/main.cpp b/WebKitTools/DumpRenderTree/qt/main.cpp
index 6f61f83..768ceb4 100644
--- a/WebKitTools/DumpRenderTree/qt/main.cpp
+++ b/WebKitTools/DumpRenderTree/qt/main.cpp
@@ -40,6 +40,7 @@
#include <qwebsettings.h>
#include <qwebdatabase.h>
#include <qdesktopservices.h>
+#include <qtimer.h>
#include <qwindowsstyle.h>
#ifdef Q_WS_X11
@@ -133,38 +134,38 @@ int main(int argc, char* argv[])
QStringList args = app.arguments();
if (args.count() < 2) {
- qDebug() << "Usage: DumpRenderTree [-v] filename";
+ qDebug() << "Usage: DumpRenderTree [-v|--pixel-tests] filename";
exit(0);
}
- // supress debug output from Qt if not started with -v
+ // Suppress debug output from Qt if not started with -v
if (!args.contains(QLatin1String("-v")))
qInstallMsgHandler(messageHandler);
WebCore::DumpRenderTree dumper;
- if (args.contains("--pixel-tests"))
+ if (args.contains(QLatin1String("--pixel-tests")))
dumper.setDumpPixels(true);
QString dbDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QDir::separator() + "qtwebkitdrt";
QWebSettings::setOfflineStoragePath(dbDir);
QWebDatabase::removeAllDatabases();
- if (args.last() == QLatin1String("-")) {
- dumper.open();
+ if (args.contains(QLatin1String("-"))) {
+ QObject::connect(&dumper, SIGNAL(ready()), &dumper, SLOT(readLine()), Qt::QueuedConnection);
+ QTimer::singleShot(0, &dumper, SLOT(readLine()));
} else {
- if (!args.last().startsWith("/")
- && !args.last().startsWith("file:")
- && !args.last().startsWith("http:")
- && !args.last().startsWith("https:")) {
- QString path = QDir::currentPath();
- if (!path.endsWith('/'))
- path.append('/');
- args.last().prepend(path);
+ dumper.setSingleFileMode(true);
+ for (int i = 1; i < args.size(); ++i) {
+ if (!args.at(i).startsWith('-')) {
+ dumper.processLine(args.at(i));
+ break;
+ }
}
- dumper.open(QUrl(args.last()));
}
+
return app.exec();
+
#ifdef Q_WS_X11
FcConfigSetCurrent(0);
#endif
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list