Title: [92963] trunk/Source/WebKit/qt
- Revision
- 92963
- Author
- [email protected]
- Date
- 2011-08-12 08:15:16 -0700 (Fri, 12 Aug 2011)
Log 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):
Modified Paths
Diff
Modified: trunk/Source/WebKit/qt/ChangeLog (92962 => 92963)
--- trunk/Source/WebKit/qt/ChangeLog 2011-08-12 14:56:04 UTC (rev 92962)
+++ trunk/Source/WebKit/qt/ChangeLog 2011-08-12 15:15:16 UTC (rev 92963)
@@ -1,3 +1,23 @@
+2011-08-12 Caio Marcelo de Oliveira Filho <[email protected]>
+
+ [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):
+
2011-08-12 Alexis Menard <[email protected]>
[Qt] Make sure QtWebKit correctly compiles when building WebKit2 with Qt5.
Modified: trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp (92962 => 92963)
--- trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp 2011-08-12 14:56:04 UTC (rev 92962)
+++ trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp 2011-08-12 15:15:16 UTC (rev 92963)
@@ -28,6 +28,7 @@
#include <QMainWindow>
#include <QMenu>
#include <QPushButton>
+#include <QStateMachine>
#include <QStyle>
#include <QtTest/QtTest>
#include <QTextCharFormat>
@@ -159,6 +160,8 @@
void navigatorCookieEnabled();
void deleteQWebViewTwice();
void renderOnRepaintRequestedShouldNotRecurse();
+ void loadSignalsOrder_data();
+ void loadSignalsOrder();
#ifdef Q_OS_MAC
void macCopyUnicodeToClipboard();
@@ -3141,5 +3144,59 @@
QVERIFY(::waitForSignal(&r, SIGNAL(finished())));
}
+class SpyForLoadSignalsOrder : public QStateMachine {
+ Q_OBJECT
+public:
+ SpyForLoadSignalsOrder(QWebPage* page, QObject* parent = 0)
+ : QStateMachine(parent)
+ {
+ connect(page, SIGNAL(loadProgress(int)), SLOT(onLoadProgress(int)));
+
+ QState* waitingForLoadStarted = new QState(this);
+ QState* waitingForLastLoadProgress = new QState(this);
+ QState* waitingForLoadFinished = new QState(this);
+ QFinalState* final = new QFinalState(this);
+
+ waitingForLoadStarted->addTransition(page, SIGNAL(loadStarted()), waitingForLastLoadProgress);
+ waitingForLastLoadProgress->addTransition(this, SIGNAL(lastLoadProgress()), waitingForLoadFinished);
+ waitingForLoadFinished->addTransition(page, SIGNAL(loadFinished(bool)), final);
+
+ setInitialState(waitingForLoadStarted);
+ start();
+ }
+ bool isFinished() const
+ {
+ return !isRunning();
+ }
+public Q_SLOTS:
+ void onLoadProgress(int progress)
+ {
+ if (progress == 100)
+ emit lastLoadProgress();
+ }
+signals:
+ void lastLoadProgress();
+};
+
+void tst_QWebPage::loadSignalsOrder_data()
+{
+ QTest::addColumn<QUrl>("url");
+ QTest::newRow("inline data") << QUrl("data:text/html,This is first page");
+ QTest::newRow("simple page") << QUrl("qrc:///resources/content.html");
+ QTest::newRow("frameset page") << QUrl("qrc:///resources/index.html");
+}
+
+void tst_QWebPage::loadSignalsOrder()
+{
+ QSKIP("https://bugs.webkit.org/show_bug.cgi?id=28851", SkipAll);
+
+ QFETCH(QUrl, url);
+ QWebPage page;
+ SpyForLoadSignalsOrder loadSpy(&page);
+ waitForSignal(&loadSpy, SIGNAL(started()));
+ page.mainFrame()->load(url);
+ QTRY_VERIFY(loadSpy.isFinished());
+}
+
QTEST_MAIN(tst_QWebPage)
#include "tst_qwebpage.moc"
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes