Changeset 92963 in webkit


Ignore:
Timestamp:
Aug 12, 2011 8:15:16 AM (13 years ago)
Author:
caio.oliveira@openbossa.org
Message:

[Qt] Add test for correct order of load signals in QWebPage
https://bugs.webkit.org/show_bug.cgi?id=66016

Reviewed by Benjamin Poulain.

Add API test to ensure the order of load signals: loadStarted() needs to be emitted
first, then loadProgress(100), followed by loadFinished().

The test is skipped since this right now is broken, the bug
https://bugs.webkit.org/show_bug.cgi?id=28851 tracks one possible way to fix.

  • tests/qwebpage/tst_qwebpage.cpp:

(SpyForLoadSignalsOrder::SpyForLoadSignalsOrder):
(SpyForLoadSignalsOrder::isFinished):
(SpyForLoadSignalsOrder::onLoadProgress):
(tst_QWebPage::loadSignalsOrder_data):
(tst_QWebPage::loadSignalsOrder):

Location:
trunk/Source/WebKit/qt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/qt/ChangeLog

    r92960 r92963  
     12011-08-12  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
     2
     3        [Qt] Add test for correct order of load signals in QWebPage
     4        https://bugs.webkit.org/show_bug.cgi?id=66016
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Add API test to ensure the order of load signals: loadStarted() needs to be emitted
     9        first, then loadProgress(100), followed by loadFinished().
     10
     11        The test is skipped since this right now is broken, the bug
     12        https://bugs.webkit.org/show_bug.cgi?id=28851 tracks one possible way to fix.
     13
     14        * tests/qwebpage/tst_qwebpage.cpp:
     15        (SpyForLoadSignalsOrder::SpyForLoadSignalsOrder):
     16        (SpyForLoadSignalsOrder::isFinished):
     17        (SpyForLoadSignalsOrder::onLoadProgress):
     18        (tst_QWebPage::loadSignalsOrder_data):
     19        (tst_QWebPage::loadSignalsOrder):
     20
    1212011-08-12  Alexis Menard  <alexis.menard@openbossa.org>
    222
  • trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

    r92182 r92963  
    2929#include <QMenu>
    3030#include <QPushButton>
     31#include <QStateMachine>
    3132#include <QStyle>
    3233#include <QtTest/QtTest>
     
    160161    void deleteQWebViewTwice();
    161162    void renderOnRepaintRequestedShouldNotRecurse();
     163    void loadSignalsOrder_data();
     164    void loadSignalsOrder();
    162165
    163166#ifdef Q_OS_MAC
     
    31423145}
    31433146
     3147class SpyForLoadSignalsOrder : public QStateMachine {
     3148    Q_OBJECT
     3149public:
     3150    SpyForLoadSignalsOrder(QWebPage* page, QObject* parent = 0)
     3151        : QStateMachine(parent)
     3152    {
     3153        connect(page, SIGNAL(loadProgress(int)), SLOT(onLoadProgress(int)));
     3154
     3155        QState* waitingForLoadStarted = new QState(this);
     3156        QState* waitingForLastLoadProgress = new QState(this);
     3157        QState* waitingForLoadFinished = new QState(this);
     3158        QFinalState* final = new QFinalState(this);
     3159
     3160        waitingForLoadStarted->addTransition(page, SIGNAL(loadStarted()), waitingForLastLoadProgress);
     3161        waitingForLastLoadProgress->addTransition(this, SIGNAL(lastLoadProgress()), waitingForLoadFinished);
     3162        waitingForLoadFinished->addTransition(page, SIGNAL(loadFinished(bool)), final);
     3163
     3164        setInitialState(waitingForLoadStarted);
     3165        start();
     3166    }
     3167    bool isFinished() const
     3168    {
     3169        return !isRunning();
     3170    }
     3171public Q_SLOTS:
     3172    void onLoadProgress(int progress)
     3173    {
     3174        if (progress == 100)
     3175            emit lastLoadProgress();
     3176    }
     3177signals:
     3178    void lastLoadProgress();
     3179};
     3180
     3181void tst_QWebPage::loadSignalsOrder_data()
     3182{
     3183    QTest::addColumn<QUrl>("url");
     3184    QTest::newRow("inline data") << QUrl("data:text/html,This is first page");
     3185    QTest::newRow("simple page") << QUrl("qrc:///resources/content.html");
     3186    QTest::newRow("frameset page") << QUrl("qrc:///resources/index.html");
     3187}
     3188
     3189void tst_QWebPage::loadSignalsOrder()
     3190{
     3191    QSKIP("https://bugs.webkit.org/show_bug.cgi?id=28851", SkipAll);
     3192
     3193    QFETCH(QUrl, url);
     3194    QWebPage page;
     3195    SpyForLoadSignalsOrder loadSpy(&page);
     3196    waitForSignal(&loadSpy, SIGNAL(started()));
     3197    page.mainFrame()->load(url);
     3198    QTRY_VERIFY(loadSpy.isFinished());
     3199}
     3200
    31443201QTEST_MAIN(tst_QWebPage)
    31453202#include "tst_qwebpage.moc"
Note: See TracChangeset for help on using the changeset viewer.