Changeset 92199 in webkit
- Timestamp:
- Aug 2, 2011 10:00:28 AM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r92198 r92199 1 2011-07-29 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> 2 3 [Qt] Add QtWebProcess in PATH at runtime for WebKit2 API auto tests. 4 https://bugs.webkit.org/show_bug.cgi?id=65378 5 6 Reviewed by Benjamin Poulain. 7 8 This prevent the runner of the tests from having to add it to PATH himself. 9 10 * UIProcess/API/qt/tests/commonviewtests/tst_commonviewtests.cpp: 11 (tst_CommonViewTests::tst_CommonViewTests): 12 * UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp: 13 (tst_QDesktopWebView::tst_QDesktopWebView): 14 * UIProcess/API/qt/tests/qtouchwebview/tst_qtouchwebview.cpp: 15 (tst_QTouchWebView::tst_QTouchWebView): 16 * UIProcess/API/qt/tests/tests.pri: 17 * UIProcess/API/qt/tests/util.cpp: Copied from Source/WebKit2/UIProcess/API/qt/tests/util.h. 18 Move definitions to a cpp file to prevent unused static symbol warnings. 19 (addQtWebProcessToPath): 20 (waitForSignal): 21 * UIProcess/API/qt/tests/util.h: 22 1 23 2011-07-12 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> 2 24 -
trunk/Source/WebKit2/UIProcess/API/qt/tests/commonviewtests/tst_commonviewtests.cpp
r91985 r92199 26 26 class tst_CommonViewTests : public QObject { 27 27 Q_OBJECT 28 public: 29 tst_CommonViewTests(); 30 28 31 private slots: 29 32 void init(); … … 44 47 QScopedPointer<WebViewAbstraction> viewAbstraction; 45 48 }; 49 50 tst_CommonViewTests::tst_CommonViewTests() 51 { 52 addQtWebProcessToPath(); 53 } 46 54 47 55 void tst_CommonViewTests::init() -
trunk/Source/WebKit2/UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp
r90844 r92199 27 27 class tst_QDesktopWebView : public QObject { 28 28 Q_OBJECT 29 public: 30 tst_QDesktopWebView(); 29 31 30 32 private slots: … … 39 41 QScopedPointer<TestWindow> m_window; 40 42 }; 43 44 tst_QDesktopWebView::tst_QDesktopWebView() 45 { 46 addQtWebProcessToPath(); 47 } 41 48 42 49 void tst_QDesktopWebView::init() -
trunk/Source/WebKit2/UIProcess/API/qt/tests/qtouchwebview/tst_qtouchwebview.cpp
r90837 r92199 23 23 #include <qtouchwebview.h> 24 24 #include "../testwindow.h" 25 #include "../util.h" 25 26 26 27 Q_DECLARE_METATYPE(QTouchWebPage*); … … 44 45 tst_QTouchWebView::tst_QTouchWebView() 45 46 { 47 addQtWebProcessToPath(); 46 48 qRegisterMetaType<QTouchWebPage*>("QTouchWebPage*"); 47 49 } -
trunk/Source/WebKit2/UIProcess/API/qt/tests/tests.pri
r91863 r92199 7 7 ELSE { TARGET = tst_$$TARGET } 8 8 9 SOURCES += $${TARGET}.cpp 9 SOURCES += $${TARGET}.cpp \ 10 ../util.cpp 10 11 INCLUDEPATH += $$PWD 11 12 … … 14 15 15 16 QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR 16 DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD\\\" 17 DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD\\\" \ 18 QWP_PATH=\\\"$$OUTPUT_DIR/bin\\\" -
trunk/Source/WebKit2/UIProcess/API/qt/tests/util.cpp
r92198 r92199 17 17 Boston, MA 02110-1301, USA. 18 18 */ 19 // Functions and macros that really need to be in QTestLib20 19 21 #include <QEventLoop> 22 #include <QSignalSpy> 23 #include <QTimer> 20 #include "util.h" 24 21 25 #if !defined(TESTS_SOURCE_DIR) 26 #define TESTS_SOURCE_DIR "" 27 #endif 22 void addQtWebProcessToPath() 23 { 24 // Since tests won't find ./QtWebProcess, add it to PATH (at the end to prevent surprises). 25 // QWP_PATH should be defined by qmake. 26 qputenv("PATH", qgetenv("PATH") + ":" + QWP_PATH); 27 } 28 28 29 29 /** … … 35 35 * \p false on timeout 36 36 */ 37 static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000)37 bool waitForSignal(QObject* obj, const char* signal, int timeout) 38 38 { 39 39 QEventLoop loop; … … 50 50 } 51 51 52 // Will try to wait for the condition while allowing event processing53 #define QTRY_VERIFY(__expr) \54 do { \55 const int __step = 50; \56 const int __timeout = 5000; \57 if (!(__expr)) { \58 QTest::qWait(0); \59 } \60 for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \61 QTest::qWait(__step); \62 } \63 QVERIFY(__expr); \64 } while(0)65 66 // Will try to wait for the condition while allowing event processing67 #define QTRY_COMPARE(__expr, __expected) \68 do { \69 const int __step = 50; \70 const int __timeout = 5000; \71 if ((__expr) != (__expected)) { \72 QTest::qWait(0); \73 } \74 for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \75 QTest::qWait(__step); \76 } \77 QCOMPARE(__expr, __expected); \78 } while(0) -
trunk/Source/WebKit2/UIProcess/API/qt/tests/util.h
r79945 r92199 27 27 #endif 28 28 29 /** 30 * Starts an event loop that runs until the given signal is received. 31 * Optionally the event loop 32 * can return earlier on a timeout. 33 * 34 * \return \p true if the requested signal was received 35 * \p false on timeout 36 */ 37 static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000) 38 { 39 QEventLoop loop; 40 QObject::connect(obj, signal, &loop, SLOT(quit())); 41 QTimer timer; 42 QSignalSpy timeoutSpy(&timer, SIGNAL(timeout())); 43 if (timeout > 0) { 44 QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); 45 timer.setSingleShot(true); 46 timer.start(timeout); 47 } 48 loop.exec(); 49 return timeoutSpy.isEmpty(); 50 } 29 void addQtWebProcessToPath(); 30 bool waitForSignal(QObject*, const char* signal, int timeout = 10000); 51 31 52 32 // Will try to wait for the condition while allowing event processing
Note: See TracChangeset
for help on using the changeset viewer.