summaryrefslogtreecommitdiffstats
path: root/tests/auto/core/certificateerror
diff options
context:
space:
mode:
authorKirill Burtsev <kirill.burtsev@qt.io>2021-05-20 17:16:00 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-08-10 21:03:35 +0000
commit92b5d1cfe46f25189235953bde0266d79098fc06 (patch)
tree3291022d0602458dac39d004b4770bd569d8e923 /tests/auto/core/certificateerror
parent513c5435536c041eb89136fbc322a68e38caf845 (diff)
Ensure certificate error callback call for all types
Amends a2a9ea11f9. Actually reject certificate when it's considered to be fatal. Adapt tests for possible regression but checking if load really failed (due to missing internet access) or was just halted by missing callback call internaly. Change-Id: I656525c353ce410f7bda8c55227a29fcd617bfdd Reviewed-by: Michal Klocek <michal.klocek@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 3acfd3b1cd39e89fb6bc2f0da3412f07d68de7b6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/core/certificateerror')
-rw-r--r--tests/auto/core/certificateerror/tst_certificateerror.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/auto/core/certificateerror/tst_certificateerror.cpp b/tests/auto/core/certificateerror/tst_certificateerror.cpp
index da679fa8a..3c43d997f 100644
--- a/tests/auto/core/certificateerror/tst_certificateerror.cpp
+++ b/tests/auto/core/certificateerror/tst_certificateerror.cpp
@@ -139,13 +139,19 @@ void tst_CertificateError::fatalError()
QSignalSpy loadFinishedSpy(&page, &QWebEnginePage::loadFinished);
page.setUrl(QUrl("https://revoked.badssl.com"));
- if (!loadFinishedSpy.wait(10000))
+ if (!loadFinishedSpy.wait(10000)) {
+ QVERIFY2(!page.error, "There shouldn't be any certificate error if not loaded due to missing internet access!");
QSKIP("Couldn't load page from network, skipping test.");
- QTRY_VERIFY(page.error);
- QVERIFY(!page.error->isOverridable());
+ }
- // Fatal certificate errors are implicitly rejected. This should not cause crash.
- page.error->rejectCertificate();
+ // revoked certificate might not be reported as invalid by chromium and the load will silently succeed
+ bool failed = !loadFinishedSpy.first().first().toBool(), hasError = bool(page.error);
+ QCOMPARE(failed, hasError);
+ if (hasError) {
+ QVERIFY(!page.error->isOverridable());
+ // Fatal certificate errors are implicitly rejected. But second call should not cause crash.
+ page.error->rejectCertificate();
+ }
}
QTEST_MAIN(tst_CertificateError)