summaryrefslogtreecommitdiffstats
path: root/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/qt/tests/qwebpage/tst_qwebpage.cpp')
-rw-r--r--WebKit/qt/tests/qwebpage/tst_qwebpage.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index ceb8aff..630ccce 100644
--- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -122,7 +122,8 @@ private slots:
void originatingObjectInNetworkRequests();
void testJSPrompt();
void showModalDialog();
-
+ void testStopScheduledPageRefresh();
+
private:
QWebView* m_view;
QWebPage* m_page;
@@ -2090,5 +2091,30 @@ void tst_QWebPage::showModalDialog()
QCOMPARE(res, QString("This is a test"));
}
+void tst_QWebPage::testStopScheduledPageRefresh()
+{
+ // Without QWebPage::StopScheduledPageRefresh
+ QWebPage page1;
+ page1.setNetworkAccessManager(new TestNetworkManager(&page1));
+ page1.mainFrame()->setHtml("<html><head>"
+ "<meta http-equiv=\"refresh\"content=\"0;URL=http://qt.nokia.com/favicon.ico\">"
+ "</head><body><h1>Page redirects immediately...</h1>"
+ "</body></html>");
+ QVERIFY(::waitForSignal(&page1, SIGNAL(loadFinished(bool))));
+ QTest::qWait(500);
+ QCOMPARE(page1.mainFrame()->url().toString(), QString("http://qt.nokia.com/favicon.ico"));
+
+ // With QWebPage::StopScheduledPageRefresh
+ QWebPage page2;
+ page2.setNetworkAccessManager(new TestNetworkManager(&page2));
+ page2.mainFrame()->setHtml("<html><head>"
+ "<meta http-equiv=\"refresh\"content=\"1;URL=http://qt.nokia.com/favicon.ico\">"
+ "</head><body><h1>Page redirect test with 1 sec timeout...</h1>"
+ "</body></html>");
+ page2.triggerAction(QWebPage::StopScheduledPageRefresh);
+ QTest::qWait(1500);
+ QCOMPARE(page2.mainFrame()->url().toString(), QString("about:blank"));
+}
+
QTEST_MAIN(tst_QWebPage)
#include "tst_qwebpage.moc"