qt5base-lts/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp
Lucie Gérard 05fc3aef53 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-16 16:37:38 +02:00

76 lines
1.5 KiB
C++

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <qcoreapplication.h>
#include <qsslconfiguration.h>
#include <qsslsocket.h>
#include "../../../../auto/network-settings.h"
class tst_QSslSocket : public QObject
{
Q_OBJECT
public:
tst_QSslSocket();
virtual ~tst_QSslSocket();
public slots:
void initTestCase();
void init();
void cleanup();
private slots:
void rootCertLoading();
void systemCaCertificates();
};
tst_QSslSocket::tst_QSslSocket()
{
}
tst_QSslSocket::~tst_QSslSocket()
{
}
void tst_QSslSocket::initTestCase()
{
if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
}
void tst_QSslSocket::init()
{
}
void tst_QSslSocket::cleanup()
{
}
//----------------------------------------------------------------------------------
void tst_QSslSocket::rootCertLoading()
{
QBENCHMARK_ONCE {
QSslSocket socket;
socket.connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
socket.waitForEncrypted();
}
}
void tst_QSslSocket::systemCaCertificates()
{
// The results of this test change if the benchmarking system changes too much.
// Therefore this benchmark is only good for manual regression checking between
// Qt versions.
QBENCHMARK_ONCE {
QList<QSslCertificate> list = QSslConfiguration::defaultConfiguration().systemCaCertificates();
}
}
QTEST_MAIN(tst_QSslSocket)
#include "tst_qsslsocket.moc"