Diff
Modified: trunk/Source/WebKit2/ChangeLog (92198 => 92199)
--- trunk/Source/WebKit2/ChangeLog 2011-08-02 17:00:08 UTC (rev 92198)
+++ trunk/Source/WebKit2/ChangeLog 2011-08-02 17:00:28 UTC (rev 92199)
@@ -1,3 +1,25 @@
+2011-07-29 Jocelyn Turcotte <[email protected]>
+
+ [Qt] Add QtWebProcess in PATH at runtime for WebKit2 API auto tests.
+ https://bugs.webkit.org/show_bug.cgi?id=65378
+
+ Reviewed by Benjamin Poulain.
+
+ This prevent the runner of the tests from having to add it to PATH himself.
+
+ * UIProcess/API/qt/tests/commonviewtests/tst_commonviewtests.cpp:
+ (tst_CommonViewTests::tst_CommonViewTests):
+ * UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp:
+ (tst_QDesktopWebView::tst_QDesktopWebView):
+ * UIProcess/API/qt/tests/qtouchwebview/tst_qtouchwebview.cpp:
+ (tst_QTouchWebView::tst_QTouchWebView):
+ * UIProcess/API/qt/tests/tests.pri:
+ * UIProcess/API/qt/tests/util.cpp: Copied from Source/WebKit2/UIProcess/API/qt/tests/util.h.
+ Move definitions to a cpp file to prevent unused static symbol warnings.
+ (addQtWebProcessToPath):
+ (waitForSignal):
+ * UIProcess/API/qt/tests/util.h:
+
2011-07-12 Jocelyn Turcotte <[email protected]>
TiledDrawingArea: Handle update requests in the order they were received.
Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/commonviewtests/tst_commonviewtests.cpp (92198 => 92199)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/commonviewtests/tst_commonviewtests.cpp 2011-08-02 17:00:08 UTC (rev 92198)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/commonviewtests/tst_commonviewtests.cpp 2011-08-02 17:00:28 UTC (rev 92199)
@@ -25,6 +25,9 @@
class tst_CommonViewTests : public QObject {
Q_OBJECT
+public:
+ tst_CommonViewTests();
+
private slots:
void init();
void cleanup();
@@ -44,6 +47,11 @@
QScopedPointer<WebViewAbstraction> viewAbstraction;
};
+tst_CommonViewTests::tst_CommonViewTests()
+{
+ addQtWebProcessToPath();
+}
+
void tst_CommonViewTests::init()
{
viewAbstraction.reset(new WebViewAbstraction);
Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp (92198 => 92199)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp 2011-08-02 17:00:08 UTC (rev 92198)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp 2011-08-02 17:00:28 UTC (rev 92199)
@@ -26,6 +26,8 @@
class tst_QDesktopWebView : public QObject {
Q_OBJECT
+public:
+ tst_QDesktopWebView();
private slots:
void init();
@@ -39,6 +41,11 @@
QScopedPointer<TestWindow> m_window;
};
+tst_QDesktopWebView::tst_QDesktopWebView()
+{
+ addQtWebProcessToPath();
+}
+
void tst_QDesktopWebView::init()
{
m_window.reset(new TestWindow(new QDesktopWebView()));
Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qtouchwebview/tst_qtouchwebview.cpp (92198 => 92199)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qtouchwebview/tst_qtouchwebview.cpp 2011-08-02 17:00:08 UTC (rev 92198)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qtouchwebview/tst_qtouchwebview.cpp 2011-08-02 17:00:28 UTC (rev 92199)
@@ -22,6 +22,7 @@
#include <qtouchwebpage.h>
#include <qtouchwebview.h>
#include "../testwindow.h"
+#include "../util.h"
Q_DECLARE_METATYPE(QTouchWebPage*);
@@ -43,6 +44,7 @@
tst_QTouchWebView::tst_QTouchWebView()
{
+ addQtWebProcessToPath();
qRegisterMetaType<QTouchWebPage*>("QTouchWebPage*");
}
Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/tests.pri (92198 => 92199)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/tests.pri 2011-08-02 17:00:08 UTC (rev 92198)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/tests.pri 2011-08-02 17:00:28 UTC (rev 92199)
@@ -6,11 +6,13 @@
CONFIG(QTDIR_build) { load(qttest_p4) }
ELSE { TARGET = tst_$$TARGET }
-SOURCES += $${TARGET}.cpp
+SOURCES += $${TARGET}.cpp \
+ ../util.cpp
INCLUDEPATH += $$PWD
include(../../../../../WebKit.pri)
QT += testlib declarative
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD\\\"
+DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD\\\" \
+ QWP_PATH=\\\"$$OUTPUT_DIR/bin\\\"
Copied: trunk/Source/WebKit2/UIProcess/API/qt/tests/util.cpp (from rev 92198, trunk/Source/WebKit2/UIProcess/API/qt/tests/util.h) (0 => 92199)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/util.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/util.cpp 2011-08-02 17:00:28 UTC (rev 92199)
@@ -0,0 +1,51 @@
+/*
+ Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "util.h"
+
+void addQtWebProcessToPath()
+{
+ // Since tests won't find ./QtWebProcess, add it to PATH (at the end to prevent surprises).
+ // QWP_PATH should be defined by qmake.
+ qputenv("PATH", qgetenv("PATH") + ":" + QWP_PATH);
+}
+
+/**
+ * Starts an event loop that runs until the given signal is received.
+ * Optionally the event loop
+ * can return earlier on a timeout.
+ *
+ * \return \p true if the requested signal was received
+ * \p false on timeout
+ */
+bool waitForSignal(QObject* obj, const char* signal, int timeout)
+{
+ QEventLoop loop;
+ QObject::connect(obj, signal, &loop, SLOT(quit()));
+ QTimer timer;
+ QSignalSpy timeoutSpy(&timer, SIGNAL(timeout()));
+ if (timeout > 0) {
+ QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
+ timer.setSingleShot(true);
+ timer.start(timeout);
+ }
+ loop.exec();
+ return timeoutSpy.isEmpty();
+}
+
Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/util.h (92198 => 92199)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/util.h 2011-08-02 17:00:08 UTC (rev 92198)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/util.h 2011-08-02 17:00:28 UTC (rev 92199)
@@ -26,28 +26,8 @@
#define TESTS_SOURCE_DIR ""
#endif
-/**
- * Starts an event loop that runs until the given signal is received.
- * Optionally the event loop
- * can return earlier on a timeout.
- *
- * \return \p true if the requested signal was received
- * \p false on timeout
- */
-static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000)
-{
- QEventLoop loop;
- QObject::connect(obj, signal, &loop, SLOT(quit()));
- QTimer timer;
- QSignalSpy timeoutSpy(&timer, SIGNAL(timeout()));
- if (timeout > 0) {
- QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
- timer.setSingleShot(true);
- timer.start(timeout);
- }
- loop.exec();
- return timeoutSpy.isEmpty();
-}
+void addQtWebProcessToPath();
+bool waitForSignal(QObject*, const char* signal, int timeout = 10000);
// Will try to wait for the condition while allowing event processing
#define QTRY_VERIFY(__expr) \