summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorKirill Burtsev <kirill.burtsev@qt.io>2021-05-20 23:20:14 +0200
committerKirill Burtsev <kirill.burtsev@qt.io>2021-06-10 18:28:52 +0200
commit40a7fe06b96652b09209672528afa720b8548525 (patch)
treed5cf4df7ffdfe1f6459251575c90e189b71123fd /tests/auto
parent4a5a1ab7849bba6aed87132296c79ca9dba6d113 (diff)
Remove separate quick certificate error test
Since api types and implementation are shared, this test duplicates the same test in widgets part. Also tiny qml layer was always tested under separate 'qmltests' auto tests. So fix this redundancy. Pick-to: 6.2 Change-Id: I1545d06b673e1e69179f58bf55e10002e5b55ac6 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/quick/CMakeLists.txt3
-rw-r--r--tests/auto/quick/certificateerror/WebView.qml60
-rw-r--r--tests/auto/quick/certificateerror/certificateerror.pro7
-rw-r--r--tests/auto/quick/certificateerror/certificateerror.qrc5
-rw-r--r--tests/auto/quick/certificateerror/testhandler.cpp63
-rw-r--r--tests/auto/quick/certificateerror/testhandler.h59
-rw-r--r--tests/auto/quick/certificateerror/tst_certificateerror.cpp125
-rw-r--r--tests/auto/quick/quick.pro3
8 files changed, 1 insertions, 324 deletions
diff --git a/tests/auto/quick/CMakeLists.txt b/tests/auto/quick/CMakeLists.txt
index 32d58ec7f..6fd767049 100644
--- a/tests/auto/quick/CMakeLists.txt
+++ b/tests/auto/quick/CMakeLists.txt
@@ -2,9 +2,6 @@ add_subdirectory(dialogs)
add_subdirectory(publicapi)
add_subdirectory(qquickwebenginedefaultsurfaceformat)
add_subdirectory(qtbug-70248)
-if(QT_FEATURE_ssl)
- add_subdirectory(certificateerror)
-endif()
if(NOT boot2qt)
add_subdirectory(inspectorserver)
add_subdirectory(qmltests)
diff --git a/tests/auto/quick/certificateerror/WebView.qml b/tests/auto/quick/certificateerror/WebView.qml
deleted file mode 100644
index 558277dec..000000000
--- a/tests/auto/quick/certificateerror/WebView.qml
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtWebEngine 1.4
-import QtQuick.Window 2.0
-import QtTest 1.0
-import io.qt.tester 1.0
-
-Window {
- width: 50
- height: 50
- visible: true
-
- TestHandler {
- id: handler
- onLoadPage: function(url) {
- view.url = url
- }
- }
-
- WebEngineView {
- id: view
- anchors.fill: parent
- onLoadingChanged: function(load) {
- handler.loadSuccess = load.status === WebEngineView.LoadSucceededStatus
- }
- onCertificateError: function(error) {
- handler.certificateError = error
- }
- Component.onCompleted: {
- view.settings.errorPageEnabled = false
- }
- }
-}
diff --git a/tests/auto/quick/certificateerror/certificateerror.pro b/tests/auto/quick/certificateerror/certificateerror.pro
deleted file mode 100644
index 22c1275e6..000000000
--- a/tests/auto/quick/certificateerror/certificateerror.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-include(../tests.pri)
-include(../../shared/https.pri)
-QT *= webenginecore-private webenginequick webenginequick-private
-HEADERS += $$PWD/testhandler.h
-SOURCES += $$PWD/testhandler.cpp
-RESOURCES += certificateerror.qrc
-
diff --git a/tests/auto/quick/certificateerror/certificateerror.qrc b/tests/auto/quick/certificateerror/certificateerror.qrc
deleted file mode 100644
index bfc3013e7..000000000
--- a/tests/auto/quick/certificateerror/certificateerror.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>WebView.qml</file>
- </qresource>
-</RCC>
diff --git a/tests/auto/quick/certificateerror/testhandler.cpp b/tests/auto/quick/certificateerror/testhandler.cpp
deleted file mode 100644
index cb6710aa3..000000000
--- a/tests/auto/quick/certificateerror/testhandler.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "testhandler.h"
-
-TestHandler::TestHandler(QObject *parent) : QObject(parent)
-{
- setObjectName(QStringLiteral("TestListner"));
-}
-
-void TestHandler::load(const QUrl &page)
-{
- emit loadPage(page);
-}
-
-void TestHandler::setLoadSuccess(bool success)
-{
- if (m_loadSuccess != success) {
- m_loadSuccess = success;
- emit loadSuccessChanged();
- }
-}
-
-bool TestHandler::loadSuccess() const
-{
- return m_loadSuccess;
-}
-
-QWebEngineCertificateError TestHandler::certificateError() const
-{
- return *m_error;
-}
-
-void TestHandler::setCertificateError(QWebEngineCertificateError error)
-{
- m_error = new QWebEngineCertificateError(error);
- emit certificateErrorChanged();
-}
diff --git a/tests/auto/quick/certificateerror/testhandler.h b/tests/auto/quick/certificateerror/testhandler.h
deleted file mode 100644
index a6d95d9a9..000000000
--- a/tests/auto/quick/certificateerror/testhandler.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TESTHANDLER_H
-#define TESTHANDLER_H
-
-#include <QWebEngineCertificateError>
-
-class TestHandler : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QWebEngineCertificateError certificateError READ certificateError WRITE
- setCertificateError NOTIFY certificateErrorChanged)
- Q_PROPERTY(bool loadSuccess READ loadSuccess WRITE setLoadSuccess NOTIFY loadSuccessChanged)
-public:
- explicit TestHandler(QObject *parent = nullptr);
- QWebEngineCertificateError certificateError() const;
-
- void setCertificateError(QWebEngineCertificateError error);
- void setLoadSuccess(bool success);
- bool loadSuccess() const;
- void load(const QUrl &page);
-
-signals:
- void loadPage(const QUrl &page);
- void certificateErrorChanged();
- void loadSuccessChanged();
-
-private:
- QWebEngineCertificateError *m_error = nullptr;
- bool m_loadSuccess = false;
-};
-
-#endif // TESTHANDLER_H
diff --git a/tests/auto/quick/certificateerror/tst_certificateerror.cpp b/tests/auto/quick/certificateerror/tst_certificateerror.cpp
deleted file mode 100644
index c54bf707b..000000000
--- a/tests/auto/quick/certificateerror/tst_certificateerror.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "testhandler.h"
-#include <httpsserver.h>
-#include <quickutil.h>
-#include <QWebEngineCertificateError>
-#include <QQuickWebEngineProfile>
-#include <QQmlApplicationEngine>
-#include <QQuickWindow>
-#include <QtTest/QtTest>
-
-class tst_CertificateError : public QObject
-{
- Q_OBJECT
-public:
- tst_CertificateError() { }
-
-private Q_SLOTS:
- void initTestCase();
- void handleError_data();
- void handleError();
-
-private:
- QScopedPointer<QQmlApplicationEngine> m_engine;
- QQuickWindow *m_widnow = nullptr;
- TestHandler *m_handler = nullptr;
-};
-
-void tst_CertificateError::initTestCase()
-{
- QQuickWebEngineProfile::defaultProfile()->setOffTheRecord(true);
- qmlRegisterType<TestHandler>("io.qt.tester", 1, 0, "TestHandler");
- m_engine.reset(new QQmlApplicationEngine());
- m_engine->load(QUrl(QStringLiteral("qrc:/WebView.qml")));
- m_widnow = qobject_cast<QQuickWindow *>(m_engine->rootObjects().first());
- Q_ASSERT(m_widnow);
- m_handler = m_widnow->findChild<TestHandler *>(QStringLiteral("TestListner"));
- Q_ASSERT(m_handler);
-}
-
-void tst_CertificateError::handleError_data()
-{
- QTest::addColumn<bool>("deferError");
- QTest::addColumn<bool>("acceptCertificate");
- QTest::addColumn<QString>("expectedContent");
- QTest::addRow("Reject") << false << false << QString();
- QTest::addRow("DeferReject") << true << false << QString();
- QTest::addRow("DeferAccept") << true << true << "TEST";
-}
-
-void tst_CertificateError::handleError()
-{
- HttpsServer server(":/resources/server.pem",":/resources/server.key");
- server.setExpectError(true);
- QVERIFY(server.start());
-
- connect(&server, &HttpsServer::newRequest, [&](HttpReqRep *rr) {
- rr->setResponseBody(QByteArrayLiteral("<html><body>TEST</body></html>"));
- rr->sendResponse();
- });
-
- QFETCH(bool, deferError);
- QFETCH(bool, acceptCertificate);
- QFETCH(QString, expectedContent);
-
- QSignalSpy certificateErrorSpy(m_handler, &TestHandler::certificateErrorChanged);
- m_handler->load(server.url());
- QTRY_COMPARE(certificateErrorSpy.count(), 1);
- QWebEngineCertificateError error = m_handler->certificateError();
-
- if (deferError) {
- error.defer();
- return;
- }
-
- if (acceptCertificate)
- error.acceptCertificate();
- else
- error.rejectCertificate();
-
- QVERIFY(error.isOverridable());
- auto chain = error.certificateChain();
- QCOMPARE(chain.size(), 2);
- QCOMPARE(chain[0].serialNumber(), "15:91:08:23:37:91:ee:51:00:d7:4a:db:d7:8c:3b:31:f8:4f:f3:b3");
- QCOMPARE(chain[1].serialNumber(), "3c:16:83:83:59:c4:2a:65:8f:7a:b2:07:10:14:4e:2d:70:9a:3e:23");
-
- if (deferError) {
- QVERIFY(!m_handler->loadSuccess());
-
- if (acceptCertificate)
- error.acceptCertificate();
- else
- error.rejectCertificate();
- }
- QTRY_COMPARE_WITH_TIMEOUT(m_handler->loadSuccess(), acceptCertificate, 3000);
-}
-
-static QByteArrayList params;
-W_QTEST_MAIN(tst_CertificateError, params)
-#include <tst_certificateerror.moc>
diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro
index 1c1bf2ba9..1b518c27f 100644
--- a/tests/auto/quick/quick.pro
+++ b/tests/auto/quick/quick.pro
@@ -10,8 +10,7 @@ SUBDIRS += \
publicapi \
qquickwebenginedefaultsurfaceformat \
qquickwebengineview \
- qtbug-70248 \
- certificateerror
+ qtbug-70248
qtConfig(webenginequick-testsupport) {
SUBDIRS += qquickwebengineviewgraphics