Commit 0b5a7d61 authored by Peter Varga's avatar Peter Varga
Browse files

Disable error page while testing loadFail signal of Quick API


Error page should be disabled while testing loadFail signal since
testing signals of the internal error page is not possible yet.

Change-Id: I07f0bb6378fcbf5d18634197808801c94606803c
Reviewed-by: default avatarAndras Becsi <andras.becsi@digia.com>
Showing with 29 additions and 15 deletions
......@@ -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)
}
}
......
......@@ -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())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment