summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp6
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp29
2 files changed, 24 insertions, 11 deletions
diff --git a/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp b/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp
index 52e422cb9..448f488f6 100644
--- a/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp
+++ b/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp
@@ -1516,7 +1516,7 @@ void tst_QWebEngineFrame::setUrlThenLoads()
QSignalSpy finishedSpy(m_page, SIGNAL(loadFinished(bool)));
m_page->setUrl(url);
- QCOMPARE(startedSpy.count(), 1);
+ QTRY_COMPARE(startedSpy.count(), 1);
QTRY_COMPARE(urlChangedSpy.count(), 1);
QTRY_COMPARE(finishedSpy.count(), 1);
QVERIFY(finishedSpy.at(0).first().toBool());
@@ -1529,12 +1529,12 @@ void tst_QWebEngineFrame::setUrlThenLoads()
// Just after first load. URL didn't changed yet.
m_page->load(urlToLoad1);
- QTRY_COMPARE(startedSpy.count(), 2);
QEXPECT_FAIL("", "Slight change: url() will return the loaded URL immediately.", Continue);
QCOMPARE(m_page->url(), url);
QCOMPARE(m_page->requestedUrl(), urlToLoad1);
// baseUrlSync spins an event loop and this sometimes return the next result.
// QCOMPARE(baseUrlSync(m_page), baseUrl);
+ QTRY_COMPARE(startedSpy.count(), 2);
// After first URL changed.
QTRY_COMPARE(urlChangedSpy.count(), 2);
@@ -1546,11 +1546,11 @@ void tst_QWebEngineFrame::setUrlThenLoads()
// Just after second load. URL didn't changed yet.
m_page->load(urlToLoad2);
- QTRY_COMPARE(startedSpy.count(), 3);
QEXPECT_FAIL("", "Slight change: url() will return the loaded URL immediately.", Continue);
QCOMPARE(m_page->url(), urlToLoad1);
QCOMPARE(m_page->requestedUrl(), urlToLoad2);
QCOMPARE(baseUrlSync(m_page), extractBaseUrl(urlToLoad1));
+ QTRY_COMPARE(startedSpy.count(), 3);
// After second URL changed.
QTRY_COMPARE(urlChangedSpy.count(), 3);
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index bb07e2e00..7e1d811e8 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -362,21 +362,23 @@ void tst_QWebEnginePage::geolocationRequestJS()
void tst_QWebEnginePage::loadFinished()
{
- qRegisterMetaType<QNetworkRequest*>("QNetworkRequest*");
- QSignalSpy spyLoadStarted(m_view, SIGNAL(loadStarted()));
- QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool)));
+ QWebEnginePage page;
+ QSignalSpy spyLoadStarted(&page, SIGNAL(loadStarted()));
+ QSignalSpy spyLoadFinished(&page, SIGNAL(loadFinished(bool)));
- m_view->page()->load(QUrl("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html,"
+ page.load(QUrl("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html,"
"<head><meta http-equiv='refresh' content='1'></head>foo \">"
"<frame src=\"data:text/html,bar\"></frameset>"));
QTRY_COMPARE(spyLoadFinished.count(), 1);
- QTRY_VERIFY(spyLoadStarted.count() > 1);
- QTRY_VERIFY(spyLoadFinished.count() > 1);
+ QEXPECT_FAIL("", "Behavior change: Load signals are emitted only for the main frame in QtWebEngine.", Continue);
+ QTRY_VERIFY_WITH_TIMEOUT(spyLoadStarted.count() > 1, 100);
+ QEXPECT_FAIL("", "Behavior change: Load signals are emitted only for the main frame in QtWebEngine.", Continue);
+ QTRY_VERIFY_WITH_TIMEOUT(spyLoadFinished.count() > 1, 100);
spyLoadFinished.clear();
- m_view->page()->load(QUrl("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html,"
+ page.load(QUrl("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html,"
"foo \"><frame src=\"data:text/html,bar\"></frameset>"));
QTRY_COMPARE(spyLoadFinished.count(), 1);
QCOMPARE(spyLoadFinished.count(), 1);
@@ -1604,6 +1606,9 @@ void tst_QWebEnginePage::textEditing()
void tst_QWebEnginePage::requestCache()
{
+#if !defined(ACCEPTNAVIGATIONREQUEST)
+ QSKIP("ACCEPTNAVIGATIONREQUEST");
+#else
TestPage page;
QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool)));
@@ -1627,6 +1632,7 @@ void tst_QWebEnginePage::requestCache()
(int)QNetworkRequest::PreferNetwork);
QCOMPARE(page.navigations.at(2).request.attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt(),
(int)QNetworkRequest::PreferCache);
+#endif
}
void tst_QWebEnginePage::loadCachedPage()
@@ -1676,7 +1682,8 @@ void tst_QWebEnginePage::backActionUpdate()
QTRY_COMPARE(loadSpy.count(), 1);
QVERIFY(!action->isEnabled());
QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(10, 10));
- QTRY_COMPARE(loadSpy.count(), 2);
+ QEXPECT_FAIL("", "Behavior change: Load signals are emitted only for the main frame in QtWebEngine.", Continue);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 2, 100);
QVERIFY(action->isEnabled());
}
@@ -2723,6 +2730,7 @@ void tst_QWebEnginePage::defaultTextEncoding()
#endif
}
+#if defined(QWEBENGINEPAGE_ERRORPAGEEXTENSION)
class ErrorPage : public QWebEnginePage
{
public:
@@ -2745,6 +2753,7 @@ public:
return true;
}
};
+#endif
void tst_QWebEnginePage::errorPageExtension()
{
@@ -2827,6 +2836,9 @@ void tst_QWebEnginePage::errorPageExtensionInFrameset()
void tst_QWebEnginePage::errorPageExtensionLoadFinished()
{
+#if !defined(QWEBENGINEPAGE_ERRORPAGEEXTENSION)
+ QSKIP("QWEBENGINEPAGE_ERRORPAGEEXTENSION");
+#else
ErrorPage page;
m_view->setPage(&page);
@@ -2852,6 +2864,7 @@ void tst_QWebEnginePage::errorPageExtensionLoadFinished()
QVERIFY(nonExistantFrameLoadSucceded);
m_view->setPage(0);
+#endif
}
class FriendlyWebPage : public QWebEnginePage