summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qmltests/data/tst_loadFail.qml39
-rw-r--r--tests/auto/quick/qmltests/data/tst_loadUrl.qml5
2 files changed, 29 insertions, 15 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_loadFail.qml b/tests/auto/quick/qmltests/data/tst_loadFail.qml
index 7b0a1849e..694547863 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 5f51e9036..e0e185eb0 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())