summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorKirill Burtsev <kirill.burtsev@qt.io>2021-06-24 20:57:21 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-07-21 19:15:33 +0000
commit90888e4835f80f278c612a2e7d5797e915767f56 (patch)
tree78cdebb3a1619f3e130d4b401db6e86809da1311 /tests/auto
parentb9d99df607648953e4d0a97a04eaabdbe0d10c3b (diff)
WebEngineNavigationRequest: add accept/reject and deprecate setAction
Match naming with others and use accept/reject methods to handle request. Also, allow to use request object after call scope in QML. [ChangeLog][QWebEngineQuick][WebEngineNavigationRequest] setAction(action) is deprecated in favor of new accept/reject methods Change-Id: I83252370e2e83017008f6951f98b7ecad119e232 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 13254e7950a032ebbeb11b1cf54b850c8326fb30) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp2
-rw-r--r--tests/auto/quick/qmltests/data/tst_navigationRequested.qml6
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp2
3 files changed, 6 insertions, 4 deletions
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 9532dd412..fe0b9d2b4 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -333,6 +333,8 @@ static const QStringList expectedAPI = QStringList()
<< "QWebEngineNavigationRequest.RedirectNavigation --> NavigationType"
<< "QWebEngineNavigationRequest.ReloadNavigation --> NavigationType"
<< "QWebEngineNavigationRequest.TypedNavigation --> NavigationType"
+ << "QWebEngineNavigationRequest.accept() --> void"
+ << "QWebEngineNavigationRequest.reject() --> void"
<< "QWebEngineNewWindowRequest.destination --> QWebEngineNewWindowRequest::DestinationType"
<< "QWebEngineNewWindowRequest.requestedUrl --> QUrl"
<< "QWebEngineNewWindowRequest.requestedGeometry --> QRect"
diff --git a/tests/auto/quick/qmltests/data/tst_navigationRequested.qml b/tests/auto/quick/qmltests/data/tst_navigationRequested.qml
index bb2864a7d..462dc8297 100644
--- a/tests/auto/quick/qmltests/data/tst_navigationRequested.qml
+++ b/tests/auto/quick/qmltests/data/tst_navigationRequested.qml
@@ -59,20 +59,20 @@ TestWebEngineView {
signalName: "navigationRequested"
}
- onNavigationRequested: {
+ onNavigationRequested: function(request) {
if (request.isMainFrame) {
attributes.mainUrl = request.url
} else {
attributes.iframeUrl = request.url
if (shouldIgnoreSubFrameRequests) {
- request.action = WebEngineNavigationRequest.IgnoreRequest
+ request.reject()
}
}
if (request.navigationType === WebEngineNavigationRequest.LinkClickedNavigation) {
attributes.linkClickedNavigationRequested = true
if (shouldIgnoreLinkClicks) {
- request.action = WebEngineNavigationRequest.IgnoreRequest
+ request.reject()
attributes.linkClickedNavigationIgnored = true
}
}
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 7ac2b043a..8df70d917 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -557,7 +557,7 @@ private Q_SLOTS:
n.type = request.navigationType();
n.isMainFrame = request.isMainFrame();
navigations.append(n);
- request.setAction(QWebEngineNavigationRequest::AcceptRequest);
+ request.accept();
}
void slotNewWindowRequested(QWebEngineNewWindowRequest &request)
{