Changeset 53614 in webkit


Ignore:
Timestamp:
Jan 21, 2010 1:02:23 AM (14 years ago)
Author:
Simon Hausmann
Message:

[Qt] Improve the autotests of QtWebkit
https://bugs.webkit.org/show_bug.cgi?id=32216

Patch by Benjamin Poulain <benjamin.poulain@nokia.com> on 2010-01-21
Reviewed by Simon Hausmann.

Remove qWait() of the test when possible.

  • tests/qwebpage/tst_qwebpage.cpp:

(tst_QWebPage::loadFinished):
(tst_QWebPage::database):
(tst_QWebPage::testEnablePersistentStorage):
(tst_QWebPage::errorPageExtension):
(tst_QWebPage::screenshot):

Location:
trunk/WebKit/qt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/ChangeLog

    r53613 r53614  
     12010-01-21  Benjamin Poulain  <benjamin.poulain@nokia.com>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        [Qt] Improve the autotests of QtWebkit
     6        https://bugs.webkit.org/show_bug.cgi?id=32216
     7
     8        Remove qWait() of the test when possible.
     9
     10        * tests/qwebpage/tst_qwebpage.cpp:
     11        (tst_QWebPage::loadFinished):
     12        (tst_QWebPage::database):
     13        (tst_QWebPage::testEnablePersistentStorage):
     14        (tst_QWebPage::errorPageExtension):
     15        (tst_QWebPage::screenshot):
     16
    1172010-01-21  Simon Hausmann  <simon.hausmann@nokia.com>
    218
  • trunk/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

    r53267 r53614  
    1919*/
    2020
    21 
     21#include "../util.h"
     22#include <QDir>
     23#include <QGraphicsWidget>
     24#include <QLineEdit>
     25#include <QMenu>
     26#include <QPushButton>
    2227#include <QtTest/QtTest>
    23 
    2428#include <qgraphicsscene.h>
    2529#include <qgraphicsview.h>
    2630#include <qgraphicswebview.h>
     31#include <qnetworkrequest.h>
     32#include <qwebdatabase.h>
    2733#include <qwebelement.h>
    28 #include <qwebpage.h>
    29 #include <qwidget.h>
    30 #include <QGraphicsWidget>
    31 #include <qwebview.h>
    3234#include <qwebframe.h>
    3335#include <qwebhistory.h>
    34 #include <qnetworkrequest.h>
    35 #include <QDebug>
    36 #include <QLineEdit>
    37 #include <QMenu>
     36#include <qwebpage.h>
    3837#include <qwebsecurityorigin.h>
    39 #include <qwebdatabase.h>
    40 #include <QPushButton>
    41 #include <QDir>
    42 #include "../util.h"
     38#include <qwebview.h>
    4339
    4440class EventSpy : public QObject, public QList<QEvent::Type>
     
    227223    QTRY_COMPARE(spyLoadFinished.count(), 1);
    228224
    229     QTest::qWait(3000);
    230 
    231     QVERIFY(spyLoadStarted.count() > 1);
    232     QVERIFY(spyLoadFinished.count() > 1);
     225    QTRY_VERIFY(spyLoadStarted.count() > 1);
     226    QTRY_VERIFY(spyLoadFinished.count() > 1);
    233227
    234228    spyLoadFinished.clear();
     
    477471    QWebDatabase::removeAllDatabases();
    478472    QVERIFY(!origin.databases().size());
    479     QTest::qWait(1000);
    480473}
    481474
     
    15571550    QWebSettings::enablePersistentStorage();
    15581551
    1559     // Give it some time to initialize - icon database needs it
    1560     QTest::qWait(1000);
    1561 
    1562     QCOMPARE(webPage.settings()->testAttribute(QWebSettings::LocalStorageEnabled), true);
    1563     QCOMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled), true);
    1564     QCOMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled), true);
    1565 
    1566     QVERIFY(!webPage.settings()->offlineStoragePath().isEmpty());
    1567     QVERIFY(!webPage.settings()->offlineWebApplicationCachePath().isEmpty());
    1568     QVERIFY(!webPage.settings()->iconDatabasePath().isEmpty());
     1552
     1553    QTRY_COMPARE(webPage.settings()->testAttribute(QWebSettings::LocalStorageEnabled), true);
     1554    QTRY_COMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled), true);
     1555    QTRY_COMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled), true);
     1556
     1557    QTRY_VERIFY(!webPage.settings()->offlineStoragePath().isEmpty());
     1558    QTRY_VERIFY(!webPage.settings()->offlineWebApplicationCachePath().isEmpty());
     1559    QTRY_VERIFY(!webPage.settings()->iconDatabasePath().isEmpty());
    15691560}
    15701561
     
    16341625
    16351626    page->triggerAction(QWebPage::Back);
    1636     QTest::qWait(2000);
    1637     QCOMPARE(page->history()->canGoBack(), false);
    1638     QCOMPARE(page->history()->canGoForward(), true);
     1627    QTRY_COMPARE(page->history()->canGoBack(), false);
     1628    QTRY_COMPARE(page->history()->canGoForward(), true);
    16391629
    16401630    page->triggerAction(QWebPage::Forward);
    1641     QTest::qWait(2000);
    1642     QCOMPARE(page->history()->canGoBack(), true);
    1643     QCOMPARE(page->history()->canGoForward(), false);
     1631    QTRY_COMPARE(page->history()->canGoBack(), true);
     1632    QTRY_COMPARE(page->history()->canGoForward(), false);
    16441633
    16451634    page->triggerAction(QWebPage::Back);
    1646     QTest::qWait(2000);
    1647     QCOMPARE(page->history()->canGoBack(), false);
    1648     QCOMPARE(page->history()->canGoForward(), true);
    1649     QCOMPARE(page->history()->currentItem().url(), QUrl("data:text/html,foo"));
     1635    QTRY_COMPARE(page->history()->canGoBack(), false);
     1636    QTRY_COMPARE(page->history()->canGoForward(), true);
     1637    QTRY_COMPARE(page->history()->currentItem().url(), QUrl("data:text/html,foo"));
    16501638
    16511639    m_view->setPage(0);
     
    17331721    QWebFrame* mainFrame = page->mainFrame();
    17341722    mainFrame->setHtml(html, QUrl::fromLocalFile(TESTS_SOURCE_DIR));
    1735     if (html.contains("</embed>")) {
    1736         // some reasonable time for the PluginStream to feed test.swf to flash and start painting
    1737         QTest::qWait(2000);
    1738     }
     1723    ::waitForSignal(mainFrame, SIGNAL(loadFinished(bool)), 2000);
    17391724
    17401725    // take screenshot without a view
Note: See TracChangeset for help on using the changeset viewer.