diff --git a/tests/auto/quick/qmltests/data/tst_loadFail.qml b/tests/auto/quick/qmltests/data/tst_loadFail.qml index 7b0a1849e357afe1a7b22e635240aa2b7f9842a0..694547863b3c9668d3987014ea5af3b7c0e1b130 100644 --- a/tests/auto/quick/qmltests/data/tst_loadFail.qml +++ b/tests/auto/quick/qmltests/data/tst_loadFail.qml @@ -42,38 +42,49 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebEngine 1.0 +import QtWebEngine.experimental 1.0 TestWebEngineView { id: webEngineView width: 400 height: 300 - property variant testUrl - - SignalSpy { - id: spyIconChanged - target: webEngineView - signalName: "iconChanged" - } + property variant unavailableUrl TestCase { id: test name: "WebEngineViewLoadFail" + + function initTestCase() { + WebEngine.settings.errorPageEnabled = false + } + function test_fail() { - testUrl = Qt.resolvedUrl("file_that_does_not_exist.html") - webEngineView.url = testUrl + unavailableUrl = Qt.resolvedUrl("file_that_does_not_exist.html") + webEngineView.url = unavailableUrl verify(webEngineView.waitForLoadFailed()) - spyIconChanged.clear() + } - // If this testcase finishes too early, we can not handle the received replacement content. - // So we should wait to ignore this error page. - spyIconChanged.wait() + function test_fail_url() { + var url = Qt.resolvedUrl("test1.html") + webEngineView.url = url + compare(webEngineView.url, url) + verify(webEngineView.waitForLoadSucceeded()) + compare(webEngineView.url, url) + + unavailableUrl = Qt.resolvedUrl("file_that_does_not_exist.html") + webEngineView.url = unavailableUrl + compare(webEngineView.url, unavailableUrl) + verify(webEngineView.waitForLoadFailed()) + // When error page is disabled in case of LoadFail the entry of the unavailable page is not stored. + // We expect the url of the previously loaded page here. + compare(webEngineView.url, url) } } onLoadingChanged: { if (loadRequest.status == WebEngineView.LoadFailedStatus) { - test.compare(loadRequest.url, testUrl) + test.compare(loadRequest.url, unavailableUrl) test.compare(loadRequest.errorDomain, WebEngineView.InternalErrorDomain) } } diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml index 5f51e90364a58a9e33d6df94c649a0baef9baf51..e0e185eb0310bc84cc999868d1561e02a045d441 100644 --- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml +++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml @@ -42,6 +42,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebEngine 1.0 +import QtWebEngine.experimental 1.0 TestWebEngineView { id: webEngineView @@ -106,6 +107,8 @@ TestWebEngineView { } function test_urlProperty() { + WebEngine.settings.errorPageEnabled = false + var url = Qt.resolvedUrl("test1.html") webEngineView.url = url @@ -117,7 +120,7 @@ TestWebEngineView { webEngineView.url = bogusSite compare(webEngineView.url, bogusSite) verify(webEngineView.waitForLoadFailed()) - compare(webEngineView.url, bogusSite) + compare(webEngineView.url, url) webEngineView.url = "about:blank" // Reset from previous test verify(webEngineView.waitForLoadSucceeded())