Changeset 51763 in webkit
- Timestamp:
- Dec 7, 2009 6:34:50 AM (14 years ago)
- Location:
- trunk/WebKit/qt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/ChangeLog
r51761 r51763 1 2009-12-07 Benjamin Poulain <benjamin.poulain@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 [Qt] Improve the autotests of QtWebkit 6 https://bugs.webkit.org/show_bug.cgi?id=32216 7 8 Refactor tst_qwebframe to remove qWait() and use 9 the function waitForSignal() from util.h 10 11 * tests/qwebframe/tst_qwebframe.cpp: 12 1 13 2009-12-07 Benjamin Poulain <benjamin.poulain@nokia.com> 2 14 -
trunk/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
r51306 r51763 42 42 # define SRCDIR "" 43 43 #endif 44 45 //TESTED_CLASS=46 //TESTED_FILES=47 48 // Task 16019249 /**50 * Starts an event loop that runs until the given signal is received.51 Optionally the event loop52 * can return earlier on a timeout.53 *54 * \return \p true if the requested signal was received55 * \p false on timeout56 */57 static bool waitForSignal(QObject* obj, const char* signal, int timeout = 0)58 {59 QEventLoop loop;60 QObject::connect(obj, signal, &loop, SLOT(quit()));61 QTimer timer;62 QSignalSpy timeoutSpy(&timer, SIGNAL(timeout()));63 if (timeout > 0) {64 QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));65 timer.setSingleShot(true);66 timer.start(timeout);67 }68 loop.exec();69 return timeoutSpy.isEmpty();70 }71 72 /* Mostly a test for the JavaScript related parts of QWebFrame */73 74 44 75 45 struct CustomType { … … 2272 2242 2273 2243 frame->setUrl(QUrl("qrc:/test1.html")); 2274 QTest::qWait(200);2244 waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); 2275 2245 QCOMPARE(spy.count(), 1); 2276 2246 QCOMPARE(frame->requestedUrl(), QUrl("qrc:/test1.html")); … … 2278 2248 2279 2249 frame->setUrl(QUrl("qrc:/non-existent.html")); 2280 QTest::qWait(200);2250 waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); 2281 2251 QCOMPARE(spy.count(), 2); 2282 2252 QCOMPARE(frame->requestedUrl(), QUrl("qrc:/non-existent.html")); … … 2284 2254 2285 2255 frame->setUrl(QUrl("http://abcdef.abcdef")); 2286 QTest::qWait(200);2256 waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); 2287 2257 QCOMPARE(spy.count(), 3); 2288 2258 QCOMPARE(frame->requestedUrl(), QUrl("http://abcdef.abcdef/")); … … 2295 2265 QSignalSpy spy2(page.networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>))); 2296 2266 frame->setUrl(QUrl("qrc:/fake-ssl-error.html")); 2297 QTest::qWait(200);2267 waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); 2298 2268 QCOMPARE(spy2.count(), 1); 2299 2269 QCOMPARE(frame->requestedUrl(), QUrl("qrc:/fake-ssl-error.html")); … … 2353 2323 QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); 2354 2324 frame->setHtml(html); 2355 QTest::qWait(200);2325 waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); 2356 2326 QCOMPARE(spy.count(), 1); 2357 2327 … … 2372 2342 // in few seconds, the CSS should be completey loaded 2373 2343 frame->setHtml(html2); 2374 QTest::qWait(200);2344 waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); 2375 2345 QCOMPARE(spy.size(), 2); 2376 2346 … … 2390 2360 2391 2361 frame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath())); 2392 QTest::qWait(200);2362 waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); 2393 2363 QCOMPARE(spy.count(), 1); 2394 2364 … … 2501 2471 QTRY_VERIFY(view.hasFocus() && !combo->view()->hasFocus()); // Focus should be back on the WebView 2502 2472 2503 // triple the flashing time, should at least blink twice already2504 int delay = qApp->cursorFlashTime() * 3;2473 // double the flashing time, should at least blink once already 2474 int delay = qApp->cursorFlashTime() * 2; 2505 2475 2506 2476 // focus the lineedit and check if it blinks … … 2509 2479 view.installEventFilter( this ); 2510 2480 QTest::qWait(delay); 2511 QVERIFY2(m_popupTestPaintCount >= 4,2481 QVERIFY2(m_popupTestPaintCount >= 3, 2512 2482 "The input field should have a blinking caret"); 2513 2483 } … … 2653 2623 m_page->mainFrame()->setHtml(html); 2654 2624 2655 QTest::qWait(200);2625 waitForSignal(m_page->mainFrame(), SIGNAL(loadFinished(bool)), 200); 2656 2626 QCOMPARE(loadSpy.size(), 1); 2657 2627 … … 2663 2633 frame->setHtml(innerHtml); 2664 2634 2665 QTest::qWait(200);2635 waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); 2666 2636 QCOMPARE(loadSpy.size(), 2); 2667 2637 … … 2750 2720 view.show(); 2751 2721 2752 QTest::qWait (200);2722 QTest::qWaitForWindowShown(&view); 2753 2723 2754 2724 view.page()->mainFrame()->evaluateJavaScript( … … 2756 2726 2757 2727 ::waitForSignal(view.page(), SIGNAL(repaintRequested(QRect))); 2758 2759 QTest::qWait(2000);2760 2728 } 2761 2729
Note: See TracChangeset
for help on using the changeset viewer.