diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-06-06 18:30:13 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-06-06 21:33:49 +0200 |
commit | 5dd4dd1d1f83157339bac1600228895cc0c86088 (patch) | |
tree | 15f04a636c1a2dfbc3b58a71772e0d872af5e90b /tests/auto/quick/qmltests/data/tst_viewSoure.qml | |
parent | 163e262888f8d44d1c4405b420a6a58cb622aca8 (diff) |
Replace testsupport's QQuickWebEngineErrorPage with isErrorPage
Merge and unify handling of loading started/finished for quick
and widgets by removing separate quick's type for monitoring
error page load and replace it with an isErrorPage method
in WebEngineLoadRequest to indicate, that load ended with an error
page being displayed. Effectively this only slightly changes when
loading finished gets emitted: now the signal is just postponed until
error page is finished loading after initial failure.
[ChangeLog][QWebEngineQuick][WebEngineLoadingInfo] New property
'isErrorPage' which indicates that the load resulted in an error page
Change-Id: I3e59dc488429d776f7c8e083b6d0489fb30a65fc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/quick/qmltests/data/tst_viewSoure.qml')
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_viewSoure.qml | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_viewSoure.qml b/tests/auto/quick/qmltests/data/tst_viewSoure.qml index 1ee687f34..8d7c052aa 100644 --- a/tests/auto/quick/qmltests/data/tst_viewSoure.qml +++ b/tests/auto/quick/qmltests/data/tst_viewSoure.qml @@ -38,22 +38,11 @@ TestWebEngineView { height: 400 property var viewRequest: null - property var loadRequestArray: [] - - testSupport: WebEngineTestSupport { - errorPage.onLoadingChanged: function(load) { - loadRequestArray.push({ - "status": load.status, - "url": load.url - }) - } - } - onLoadingChanged: function(load) { - loadRequestArray.push({ - "status": load.status, - "url": load.url - }); + SignalSpy { + id: loadSpy + target: webEngineView + signalName: 'loadingChanged' } SignalSpy { @@ -87,6 +76,7 @@ TestWebEngineView { tryCompare(webEngineView, "loadStatus", WebEngineView.LoadSucceededStatus); webEngineView.loadStatus = null; + loadSpy.clear() newViewRequestedSpy.clear(); titleChangedSpy.clear(); viewRequest = null; @@ -107,21 +97,14 @@ TestWebEngineView { } function test_viewSourceURL(row) { - loadRequestArray = []; WebEngine.settings.errorPageEnabled = true webEngineView.url = row.userInputUrl; - - if (row.loadSucceed) { - tryVerify(function() { return loadRequestArray.length == 2 }); - compare(loadRequestArray[1].status, WebEngineView.LoadSucceededStatus); - } else { - tryVerify(function() { return loadRequestArray.length == 4 }, 90000); - // error page load is done inside main load through test support - compare(loadRequestArray[2].status, WebEngineView.LoadSucceededStatus); - compare(loadRequestArray[2].url, "chrome-error://chromewebdata/") - compare(loadRequestArray[3].status, WebEngineView.LoadFailedStatus); - } + tryCompare(loadSpy, 'count', 2); + let load = loadSpy.signalArguments[1][0] + let expectedStatus = row.loadSucceed ? WebEngineView.LoadSucceededStatus : WebEngineView.LoadFailedStatus + compare(load.status, expectedStatus); + compare(load.isErrorPage, !row.loadSucceed); tryVerify(function() { return titleChangedSpy.count == 1; }); compare(webEngineView.url, row.url); |