diff options
author | Kirill Burtsev <kirill.burtsev@qt.io> | 2021-04-30 21:30:16 +0200 |
---|---|---|
committer | Kirill Burtsev <kirill.burtsev@qt.io> | 2021-05-06 09:07:13 +0200 |
commit | 4d4fc9cd120376f30ce0630b1e8c7bf174d44fae (patch) | |
tree | 30424dfd873ff93ea3ff4f1fdf5791440c4fd69a /tests/auto/quick | |
parent | 88c9dc6801a583956e2eb5063544303b6f12f95d (diff) |
Fix inconsistent number of load signals and their order
This change tries to match how chromium treats one single load. Before
the pair of loadStarted/loadFinished methods for api classes was called
on delegate's DidStartNavigation/DidFinishNavigation, which might be many
within one single logical load. This is true for multiple usecases (like
multiple redirects on load, immediate form submit on DOM load, page's
subresource load, or just an error page load on failure). Tracking these
methods and deciding when to emit signals based on states are error-prone
and complicates logic for no benefits. Also it somewhat lies about when
real load is done, which is only started and finished on outer methods
DidStartLoading/DidStopLoading, which are conveniently called only once
for all mentioned usecases. So, this change uses these methods to issue
signals for load start/finish, and only makes exception for error page,
which is needed for quick's private test support.
Fixes: QTBUG-65223
Fixes: QTBUG-76802
Fixes: QTBUG-87089
Fixes: QTBUG-90342
Fixes: QTBUG-91773
Fixes: QTBUG-92063
Change-Id: I9cc99b639030fedd8cf6a9dc04d0869d6be6357d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'tests/auto/quick')
-rw-r--r-- | tests/auto/quick/qmltests/data/test4.html | 1 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_loadUrl.qml | 17 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/tst_loadFail.qml | 7 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/tst_viewSoure.qml | 14 |
4 files changed, 22 insertions, 17 deletions
diff --git a/tests/auto/quick/qmltests/data/test4.html b/tests/auto/quick/qmltests/data/test4.html index c9b395ee5..cf5708994 100644 --- a/tests/auto/quick/qmltests/data/test4.html +++ b/tests/auto/quick/qmltests/data/test4.html @@ -24,6 +24,7 @@ } </script> <div id="content"> + <p><a id='anchor' href='#anchor'>anchor</a> <p>bla00 <p>bla01 <p>bla02 diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml index 47dbbc087..8f589cc52 100644 --- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml +++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml @@ -298,20 +298,19 @@ TestWebEngineView { compare(loadRequestArray[0].status, WebEngineView.LoadStartedStatus); compare(loadRequestArray[1].status, WebEngineView.LoadSucceededStatus); - // In-page navigation. - webEngineView.url = Qt.resolvedUrl("test4.html#content"); - // In-page navigation doesn't trigger load succeeded, wait for load progress instead. - tryCompare(loadRequestArray, "length", 3); - tryCompare(webEngineView, "loadProgress", 100); - compare(loadRequestArray[2].status, WebEngineView.LoadStartedStatus); + // In-page navigation shouldn't trigger load + let anchorUrl = Qt.resolvedUrl("test4.html#anchor"); + let c = webEngineView.getElementCenter('anchor') + mouseClick(webEngineView, c.x, c.y) + tryCompare(webEngineView, 'url', anchorUrl) // Load after in-page navigation. webEngineView.url = Qt.resolvedUrl("test4.html"); verify(webEngineView.waitForLoadSucceeded()); compare(webEngineView.loadProgress, 100); - compare(loadRequestArray.length, 5); - compare(loadRequestArray[3].status, WebEngineView.LoadStartedStatus); - compare(loadRequestArray[4].status, WebEngineView.LoadSucceededStatus); + compare(loadRequestArray.length, 4); + compare(loadRequestArray[2].status, WebEngineView.LoadStartedStatus); + compare(loadRequestArray[3].status, WebEngineView.LoadSucceededStatus); webEngineView.clear(); } diff --git a/tests/auto/quick/qmltests2/data/tst_loadFail.qml b/tests/auto/quick/qmltests2/data/tst_loadFail.qml index db412f252..298f5b0fe 100644 --- a/tests/auto/quick/qmltests2/data/tst_loadFail.qml +++ b/tests/auto/quick/qmltests2/data/tst_loadFail.qml @@ -119,21 +119,22 @@ TestWebEngineView { verify(!loadRequest.isErrorPage) // Loading of the unavailableUrl must fail - loadRequest = loadRequestArray[1] + loadRequest = loadRequestArray[3] compare(loadRequest.status, WebEngineView.LoadFailedStatus) compare(loadRequest.errorDomain, WebEngineView.InternalErrorDomain) compare(loadRequest.url, unavailableUrl) verify(!loadRequest.isErrorPage) + // error page load is done inside main load through test support // Start to load error page - loadRequest = loadRequestArray[2] + loadRequest = loadRequestArray[1] compare(loadRequest.status, WebEngineView.LoadStartedStatus) compare(loadRequest.errorDomain, WebEngineView.NoErrorDomain) compare(loadRequest.url, "chrome-error://chromewebdata/") verify(loadRequest.isErrorPage) // Loading of the error page must be successful - loadRequest = loadRequestArray[3] + loadRequest = loadRequestArray[2] compare(loadRequest.status, WebEngineView.LoadSucceededStatus) compare(loadRequest.errorDomain, WebEngineView.NoErrorDomain) compare(loadRequest.url, "chrome-error://chromewebdata/") diff --git a/tests/auto/quick/qmltests2/data/tst_viewSoure.qml b/tests/auto/quick/qmltests2/data/tst_viewSoure.qml index 04b40f544..74b7f803d 100644 --- a/tests/auto/quick/qmltests2/data/tst_viewSoure.qml +++ b/tests/auto/quick/qmltests2/data/tst_viewSoure.qml @@ -44,6 +44,7 @@ TestWebEngineView { errorPage.onLoadingChanged: { loadRequestArray.push({ "status": loadRequest.status, + "url": loadRequest.url }) } } @@ -51,6 +52,7 @@ TestWebEngineView { onLoadingChanged: { loadRequestArray.push({ "status": loadRequest.status, + "url": loadRequest.url }); } @@ -109,14 +111,16 @@ TestWebEngineView { WebEngine.settings.errorPageEnabled = true webEngineView.url = row.userInputUrl; + if (row.loadSucceed) { - tryVerify(function() { return loadRequestArray.length >= 2 }); + tryVerify(function() { return loadRequestArray.length == 2 }); compare(loadRequestArray[1].status, WebEngineView.LoadSucceededStatus); } else { - tryVerify(function() { return loadRequestArray.length >= 2 }); - compare(loadRequestArray[1].status, WebEngineView.LoadFailedStatus); - tryVerify(function() { return loadRequestArray.length == 4 }); - compare(loadRequestArray[3].status, WebEngineView.LoadSucceededStatus); + 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); } tryVerify(function() { return titleChangedSpy.count == 1; }); |