summaryrefslogtreecommitdiffstats
path: root/Tools/DumpRenderTree/qt
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-25 19:08:45 +0100
committerSteve Block <steveblock@google.com>2011-06-08 13:51:31 +0100
commit2bde8e466a4451c7319e3a072d118917957d6554 (patch)
tree28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Tools/DumpRenderTree/qt
parent6939c99b71d9372d14a0c74a772108052e8c48c8 (diff)
downloadexternal_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Tools/DumpRenderTree/qt')
-rw-r--r--Tools/DumpRenderTree/qt/DumpRenderTree.pro2
-rw-r--r--Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp24
-rw-r--r--Tools/DumpRenderTree/qt/DumpRenderTreeQt.h6
-rw-r--r--Tools/DumpRenderTree/qt/GCControllerQt.cpp2
-rw-r--r--Tools/DumpRenderTree/qt/ImageDiff.pro1
-rw-r--r--Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp51
-rw-r--r--Tools/DumpRenderTree/qt/LayoutTestControllerQt.h11
-rw-r--r--Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp2
-rw-r--r--Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro3
-rw-r--r--Tools/DumpRenderTree/qt/TextInputControllerQt.cpp2
-rw-r--r--Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp13
-rw-r--r--Tools/DumpRenderTree/qt/WorkQueueItemQt.h18
-rw-r--r--Tools/DumpRenderTree/qt/main.cpp89
13 files changed, 195 insertions, 29 deletions
diff --git a/Tools/DumpRenderTree/qt/DumpRenderTree.pro b/Tools/DumpRenderTree/qt/DumpRenderTree.pro
index d84af96..a76b886 100644
--- a/Tools/DumpRenderTree/qt/DumpRenderTree.pro
+++ b/Tools/DumpRenderTree/qt/DumpRenderTree.pro
@@ -9,6 +9,7 @@ include(../../../Source/WebKit.pri)
INCLUDEPATH += ../../../Source
INCLUDEPATH += ../../../Source/JavaScriptCore
INCLUDEPATH += ../../../Source/JavaScriptCore/ForwardingHeaders
+INCLUDEPATH += ../../../Source/WebKit/qt/WebCoreSupport
INCLUDEPATH += $$BASEDIR
DESTDIR = ../../bin
@@ -51,3 +52,4 @@ wince*: {
}
DEFINES += USE_SYSTEM_MALLOC=1
+DEFINES -= QT_ASCII_CAST_WARNINGS
diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
index 6af6fc2..97d9f20 100644
--- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
+++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
@@ -32,7 +32,7 @@
#include "config.h"
#include "DumpRenderTreeQt.h"
-#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
+#include "DumpRenderTreeSupportQt.h"
#include "EventSenderQt.h"
#include "GCControllerQt.h"
#include "LayoutTestControllerQt.h"
@@ -499,6 +499,10 @@ DumpRenderTree::DumpRenderTree()
DumpRenderTree::~DumpRenderTree()
{
+ if (!m_redirectOutputFileName.isEmpty())
+ fclose(stdout);
+ if (!m_redirectErrorFileName.isEmpty())
+ fclose(stderr);
delete m_mainView;
delete m_stdin;
DumpRenderTreeSupportQt::removeMockDeviceOrientation();
@@ -676,9 +680,7 @@ void DumpRenderTree::processArgsLine(const QStringList &args)
{
setStandAloneMode(true);
- for (int i = 1; i < args.size(); ++i)
- if (!args.at(i).startsWith('-'))
- m_standAloneModeTestList.append(args[i]);
+ m_standAloneModeTestList = args;
QFileInfo firstEntry(m_standAloneModeTestList.first());
if (firstEntry.isDir()) {
@@ -690,11 +692,12 @@ void DumpRenderTree::processArgsLine(const QStringList &args)
for (int i = 0; i < m_standAloneModeTestList.size(); ++i)
m_standAloneModeTestList[i] = folderEntry.absoluteFilePath(m_standAloneModeTestList[i]);
}
-
- processLine(m_standAloneModeTestList.first());
- m_standAloneModeTestList.removeFirst();
-
connect(this, SIGNAL(ready()), this, SLOT(loadNextTestInStandAloneMode()));
+
+ if (!m_standAloneModeTestList.isEmpty()) {
+ QString first = m_standAloneModeTestList.takeFirst();
+ processLine(first);
+ }
}
void DumpRenderTree::loadNextTestInStandAloneMode()
@@ -703,9 +706,8 @@ void DumpRenderTree::loadNextTestInStandAloneMode()
emit quit();
return;
}
-
- processLine(m_standAloneModeTestList.first());
- m_standAloneModeTestList.removeFirst();
+ QString first = m_standAloneModeTestList.takeFirst();
+ processLine(first);
}
void DumpRenderTree::processLine(const QString &input)
diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h
index 5b53cd9..858856f 100644
--- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h
+++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h
@@ -40,7 +40,7 @@
#include <QSslError>
#endif
-#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
+#include "DumpRenderTreeSupportQt.h"
#include <qgraphicsview.h>
#include <qgraphicswebview.h>
#include <qwebframe.h>
@@ -105,6 +105,8 @@ public:
static void initializeFonts();
#endif
void processArgsLine(const QStringList&);
+ void setRedirectOutputFileName(const QString& fileName) { m_redirectOutputFileName = fileName; }
+ void setRedirectErrorFileName(const QString& fileName) { m_redirectErrorFileName = fileName; }
public Q_SLOTS:
void initJSObjects();
@@ -160,6 +162,8 @@ private:
bool m_standAloneMode;
bool m_graphicsBased;
QString m_persistentStoragePath;
+ QString m_redirectOutputFileName;
+ QString m_redirectErrorFileName;
};
class NetworkAccessManager : public QNetworkAccessManager {
diff --git a/Tools/DumpRenderTree/qt/GCControllerQt.cpp b/Tools/DumpRenderTree/qt/GCControllerQt.cpp
index 2a30ba8..a2e5e0c 100644
--- a/Tools/DumpRenderTree/qt/GCControllerQt.cpp
+++ b/Tools/DumpRenderTree/qt/GCControllerQt.cpp
@@ -29,7 +29,7 @@
#include "config.h"
#include "GCControllerQt.h"
-#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
+#include "DumpRenderTreeSupportQt.h"
#include <qwebpage.h>
diff --git a/Tools/DumpRenderTree/qt/ImageDiff.pro b/Tools/DumpRenderTree/qt/ImageDiff.pro
index cdb067e..b3d5181 100644
--- a/Tools/DumpRenderTree/qt/ImageDiff.pro
+++ b/Tools/DumpRenderTree/qt/ImageDiff.pro
@@ -14,3 +14,4 @@ unix:!mac {
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
}
+DEFINES -= QT_ASCII_CAST_WARNINGS
diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index 74055e2..4e3087e 100644
--- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -28,7 +28,7 @@
*/
#include "config.h"
#include "LayoutTestControllerQt.h"
-#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
+#include "DumpRenderTreeSupportQt.h"
#include "DumpRenderTreeQt.h"
#include "WorkQueue.h"
@@ -315,9 +315,12 @@ void LayoutTestController::queueLoad(const QString& url, const QString& target)
WorkQueue::shared()->queue(new LoadItem(absoluteUrl, target, m_drt->webPage()));
}
-void LayoutTestController::queueLoadHTMLString(const QString& content, const QString& baseURL)
+void LayoutTestController::queueLoadHTMLString(const QString& content, const QString& baseURL, const QString& failingURL)
{
- WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL, m_drt->webPage()));
+ if (failingURL.isEmpty())
+ WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL, m_drt->webPage()));
+ else
+ WorkQueue::shared()->queue(new LoadAlternateHTMLStringItem(content, baseURL, failingURL, m_drt->webPage()));
}
void LayoutTestController::queueReload()
@@ -552,6 +555,11 @@ void LayoutTestController::clearAllApplicationCaches()
DumpRenderTreeSupportQt::clearAllApplicationCaches();
}
+void LayoutTestController::clearApplicationCacheForOrigin(const QString& url)
+{
+ // FIXME: Implement to support deleting all application caches for an origin.
+}
+
void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quota)
{
if (!m_topLoadingFrame)
@@ -559,6 +567,12 @@ void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quo
m_topLoadingFrame->securityOrigin().setApplicationCacheQuota(quota);
}
+QStringList LayoutTestController::originsWithApplicationCache()
+{
+ // FIXME: Implement to get origins that have application caches.
+ return QStringList();
+}
+
void LayoutTestController::setDatabaseQuota(int size)
{
if (!m_topLoadingFrame)
@@ -766,6 +780,12 @@ void LayoutTestController::setGeolocationPermission(bool allow)
DumpRenderTreeSupportQt::setMockGeolocationPermission(m_drt->webPage(), allow);
}
+int LayoutTestController::numberOfPendingGeolocationPermissionRequests()
+{
+ // FIXME: Implement for Geolocation layout tests.
+ return -1;
+}
+
void LayoutTestController::setGeolocationPermissionCommon(bool allow)
{
m_isGeolocationPermissionSet = true;
@@ -842,5 +862,30 @@ void LayoutTestController::setMinimumTimerInterval(double minimumTimerInterval)
DumpRenderTreeSupportQt::setMinimumTimerInterval(m_drt->webPage(), minimumTimerInterval);
}
+void LayoutTestController::originsWithLocalStorage()
+{
+ // FIXME: Implement.
+}
+
+void LayoutTestController::deleteAllLocalStorage()
+{
+ // FIXME: Implement.
+}
+
+void LayoutTestController::deleteLocalStorageForOrigin(const QString& originIdentifier)
+{
+ // FIXME: Implement.
+}
+
+void LayoutTestController::observeStorageTrackerNotifications(unsigned number)
+{
+ // FIXME: Implement.
+}
+
+void LayoutTestController::syncLocalStorage()
+{
+ // FIXME: Implement.
+}
+
const unsigned LayoutTestController::maxViewWidth = 800;
const unsigned LayoutTestController::maxViewHeight = 600;
diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h
index 0b5bbba..f29233a 100644
--- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h
+++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h
@@ -121,7 +121,7 @@ public slots:
void queueBackNavigation(int howFarBackward);
void queueForwardNavigation(int howFarForward);
void queueLoad(const QString& url, const QString& target = QString());
- void queueLoadHTMLString(const QString& content, const QString& baseURL = QString());
+ void queueLoadHTMLString(const QString& content, const QString& baseURL = QString(), const QString& failingURL = QString());
void queueReload();
void queueLoadingScript(const QString& script);
void queueNonLoadingScript(const QString& script);
@@ -189,7 +189,9 @@ public slots:
void disableImageLoading();
void clearAllApplicationCaches();
+ void clearApplicationCacheForOrigin(const QString& url);
void setApplicationCacheOriginQuota(unsigned long long quota);
+ QStringList originsWithApplicationCache();
void setDatabaseQuota(int size);
void clearAllDatabases();
@@ -219,6 +221,7 @@ public slots:
void setMockGeolocationError(int code, const QString& message);
void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
void setGeolocationPermission(bool allow);
+ int numberOfPendingGeolocationPermissionRequests();
bool isGeolocationPermissionSet() const { return m_isGeolocationPermissionSet; }
bool geolocationPermission() const { return m_geolocationPermission; }
@@ -253,6 +256,12 @@ public slots:
void addUserStyleSheet(const QString& sourceCode);
void setMinimumTimerInterval(double);
+
+ void originsWithLocalStorage();
+ void deleteAllLocalStorage();
+ void deleteLocalStorageForOrigin(const QString& originIdentifier);
+ void observeStorageTrackerNotifications(unsigned number);
+ void syncLocalStorage();
private slots:
void processWork();
diff --git a/Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp b/Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp
index 729ccd0..dd63fea 100644
--- a/Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp
+++ b/Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp
@@ -28,7 +28,7 @@
#include "config.h"
#include "PlainTextControllerQt.h"
-#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
+#include "DumpRenderTreeSupportQt.h"
#include <QApplication>
#include <QInputMethodEvent>
#include <QKeyEvent>
diff --git a/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro b/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
index 96f0fc5..6741668 100644
--- a/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
+++ b/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
@@ -32,6 +32,7 @@ SOURCES = PluginObject.cpp \
Tests/EvaluateJSAfterRemovingPluginElement.cpp \
Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp \
Tests/GetUserAgentWithNullNPPFromNPPNew.cpp \
+ Tests/NPDeallocateCalledBeforeNPShutdown.cpp \
Tests/NPRuntimeObjectFromDestroyedPlugin.cpp \
Tests/NPRuntimeRemoveProperty.cpp \
Tests/NullNPPGetValuePointer.cpp \
@@ -46,6 +47,8 @@ mac {
SOURCES += ../../unix/TestNetscapePlugin/TestNetscapePlugin.cpp
}
+DEFINES -= QT_ASCII_CAST_WARNINGS
+
!win32:!embedded:!mac:!symbian {
LIBS += -lX11
}
diff --git a/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp b/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp
index 9112674..8cf2e4e 100644
--- a/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp
+++ b/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp
@@ -28,7 +28,7 @@
*/
#include "config.h"
#include "TextInputControllerQt.h"
-#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
+#include "DumpRenderTreeSupportQt.h"
#include <QApplication>
#include <QInputMethodEvent>
diff --git a/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp b/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp
index d1baf08..b093366 100644
--- a/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp
+++ b/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp
@@ -28,6 +28,7 @@
*/
#include "config.h"
#include "WorkQueueItemQt.h"
+#include "DumpRenderTreeSupportQt.h"
QWebFrame* findFrameNamed(const QString& frameName, QWebFrame* frame)
{
@@ -72,6 +73,18 @@ bool LoadHTMLStringItem::invoke() const
return true;
}
+bool LoadAlternateHTMLStringItem::invoke() const
+{
+ Q_ASSERT(m_webPage);
+
+ QWebFrame* frame = m_webPage->mainFrame();
+ if (!frame)
+ return false;
+
+ DumpRenderTreeSupportQt::setAlternateHtml(frame, m_content, QUrl(m_baseURL), QUrl(m_failingURL));
+ return true;
+}
+
bool ReloadItem::invoke() const
{
//qDebug() << ">>>ReloadItem::invoke";
diff --git a/Tools/DumpRenderTree/qt/WorkQueueItemQt.h b/Tools/DumpRenderTree/qt/WorkQueueItemQt.h
index 97c9b04..ac7d1b3 100644
--- a/Tools/DumpRenderTree/qt/WorkQueueItemQt.h
+++ b/Tools/DumpRenderTree/qt/WorkQueueItemQt.h
@@ -80,6 +80,24 @@ private:
QString m_baseURL;
};
+class LoadAlternateHTMLStringItem : public WorkQueueItem {
+public:
+ LoadAlternateHTMLStringItem(const QString& content, const QString& baseURL, const QString &failingURL, QWebPage *page)
+ : WorkQueueItem(page)
+ , m_content(content)
+ , m_baseURL(baseURL)
+ , m_failingURL(failingURL)
+ {
+ }
+
+private:
+ virtual bool invoke() const;
+
+ QString m_content;
+ QString m_baseURL;
+ QString m_failingURL;
+};
+
class ReloadItem : public WorkQueueItem {
public:
ReloadItem(QWebPage *page)
diff --git a/Tools/DumpRenderTree/qt/main.cpp b/Tools/DumpRenderTree/qt/main.cpp
index 8349d73..bc762e5 100644
--- a/Tools/DumpRenderTree/qt/main.cpp
+++ b/Tools/DumpRenderTree/qt/main.cpp
@@ -67,6 +67,33 @@ void messageHandler(QtMsgType type, const char *message)
// do nothing
}
+// We only support -v or --pixel-tests or --stdout or --stderr or -, all the others will be
+// pass as test case name (even -abc.html is a valid test case name)
+bool isOption(const QString& str)
+{
+ return str == QString("-v") || str == QString("--pixel-tests")
+ || str == QString("--stdout") || str == QString("--stderr")
+ || str == QString("-");
+}
+
+QString takeOptionValue(QStringList& arguments, int index)
+{
+ QString result;
+
+ if (index + 1 < arguments.count() && !isOption(arguments.at(index + 1)))
+ result = arguments.takeAt(index + 1);
+ arguments.removeAt(index);
+
+ return result;
+}
+
+void printUsage()
+{
+ fprintf(stderr, "Usage: DumpRenderTree [-v|--pixel-tests] [--stdout output_filename] [-stderr error_filename] filename [filename2..n]\n");
+ fprintf(stderr, "Or folder containing test files: DumpRenderTree [-v|--pixel-tests] dirpath\n");
+ fflush(stderr);
+}
+
QString get_backtrace() {
QString s;
@@ -143,28 +170,70 @@ int main(int argc, char* argv[])
QStringList args = app.arguments();
if (args.count() < 2) {
- qDebug() << "Usage: DumpRenderTree [-v|--pixel-tests] filename [filename2..n]";
- qDebug() << "Or folder containing test files: DumpRenderTree [-v|--pixel-tests] dirpath";
- exit(0);
+ printUsage();
+ exit(1);
}
+ // Remove the first arguments, it is application name itself
+ args.removeAt(0);
+
// Suppress debug output from Qt if not started with -v
- if (!args.contains(QLatin1String("-v")))
+ int index = args.indexOf(QLatin1String("-v"));
+ if (index == -1)
qInstallMsgHandler(messageHandler);
+ else
+ args.removeAt(index);
WebCore::DumpRenderTree dumper;
- if (args.contains(QLatin1String("--pixel-tests")))
+ index = args.indexOf(QLatin1String("--pixel-tests"));
+ if (index != -1) {
dumper.setDumpPixels(true);
+ args.removeAt(index);
+ }
+ index = args.indexOf(QLatin1String("--stdout"));
+ if (index != -1) {
+ QString fileName = takeOptionValue(args, index);
+ dumper.setRedirectOutputFileName(fileName);
+ if (fileName.isEmpty() || !freopen(qPrintable(fileName), "w", stdout)) {
+ fprintf(stderr, "STDOUT redirection failed.");
+ exit(1);
+ }
+ }
+ index = args.indexOf(QLatin1String("--stderr"));
+ if (index != -1) {
+ QString fileName = takeOptionValue(args, index);
+ dumper.setRedirectErrorFileName(fileName);
+ if (!freopen(qPrintable(fileName), "w", stderr)) {
+ fprintf(stderr, "STDERR redirection failed.");
+ exit(1);
+ }
+ }
QWebDatabase::removeAllDatabases();
- if (args.contains(QLatin1String("-"))) {
- QObject::connect(&dumper, SIGNAL(ready()), &dumper, SLOT(readLine()), Qt::QueuedConnection);
- QTimer::singleShot(0, &dumper, SLOT(readLine()));
- } else
+ index = args.indexOf(QLatin1String("-"));
+ if (index != -1) {
+ args.removeAt(index);
+
+ // Continue waiting in STDIN for more test case after process one test case
+ QObject::connect(&dumper, SIGNAL(ready()), &dumper, SLOT(readLine()), Qt::QueuedConnection);
+
+ // Read and only read the first test case, ignore the others
+ if (args.size() > 0) {
+ // Process the argument first
+ dumper.processLine(args[0]);
+ } else
+ QTimer::singleShot(0, &dumper, SLOT(readLine()));
+ } else {
+ // Go into standalone mode
+ // Standalone mode need at least one test case
+ if (args.count() < 1) {
+ printUsage();
+ exit(1);
+ }
dumper.processArgsLine(args);
-
+ }
return app.exec();
#ifdef Q_WS_X11