diff options
Diffstat (limited to 'tests/benchmarks/network/access/qnetworkreply')
-rw-r--r-- | tests/benchmarks/network/access/qnetworkreply/CMakeLists.txt | 8 | ||||
-rw-r--r-- | tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp | 24 |
2 files changed, 16 insertions, 16 deletions
diff --git a/tests/benchmarks/network/access/qnetworkreply/CMakeLists.txt b/tests/benchmarks/network/access/qnetworkreply/CMakeLists.txt index ad0224e82c..1d13192d97 100644 --- a/tests/benchmarks/network/access/qnetworkreply/CMakeLists.txt +++ b/tests/benchmarks/network/access/qnetworkreply/CMakeLists.txt @@ -1,4 +1,5 @@ -# Generated from qnetworkreply.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_bench_qnetworkreply Binary: @@ -7,12 +8,9 @@ qt_internal_add_benchmark(tst_bench_qnetworkreply SOURCES tst_qnetworkreply.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::Network Qt::NetworkPrivate Qt::Test ) - -#### Keys ignored in scope 1:.:.:qnetworkreply.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp index 651bd90b0f..bab2743513 100644 --- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only // This file contains benchmarks for QNetworkReply functions. #include <QDebug> @@ -21,6 +21,8 @@ #include <QtNetwork/private/qhostinfo_p.h> #endif +using namespace std::chrono_literals; + Q_DECLARE_METATYPE(QSharedPointer<char>) class TimedSender: public QThread @@ -456,7 +458,7 @@ void tst_qnetworkreply::httpLatency() QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/")); QNetworkReply* reply = manager.get(request); connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); - QTestEventLoop::instance().enterLoop(5); + QTestEventLoop::instance().enterLoop(5s); QVERIFY(!QTestEventLoop::instance().timeout()); delete reply; } @@ -470,7 +472,7 @@ QPair<QNetworkReply *, qint64> tst_qnetworkreply::runGetRequest( QNetworkReply *reply = manager->get(request); connect(reply, SIGNAL(sslErrors(QList<QSslError>)), reply, SLOT(ignoreSslErrors())); connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); - QTestEventLoop::instance().enterLoop(20); + QTestEventLoop::instance().enterLoop(20s); qint64 elapsed = timer.elapsed(); return qMakePair(reply, elapsed); } @@ -501,7 +503,7 @@ void tst_qnetworkreply::echoPerformance() QNetworkReply* reply = manager.post(request, data); connect(reply, SIGNAL(sslErrors(QList<QSslError>)), reply, SLOT(ignoreSslErrors())); connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); - QTestEventLoop::instance().enterLoop(5); + QTestEventLoop::instance().enterLoop(5s); QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(reply->error() == QNetworkReply::NoError); delete reply; @@ -510,7 +512,7 @@ void tst_qnetworkreply::echoPerformance() void tst_qnetworkreply::preConnectEncrypted() { - QFETCH(int, sleepTime); + QFETCH(std::chrono::milliseconds, sleepTime); QString hostName = QLatin1String("www.google.com"); QNetworkAccessManager manager; @@ -541,7 +543,7 @@ void tst_qnetworkreply::preConnectEncrypted() // now try to make the connection beforehand manager.connectToHostEncrypted(hostName); - QTestEventLoop::instance().enterLoopMSecs(sleepTime); + QTestEventLoop::instance().enterLoop(sleepTime); // now make another request and hopefully use the existing connection QPair<QNetworkReply *, qint64> preConnectResult = runGetRequest(&manager, request); @@ -559,12 +561,12 @@ void tst_qnetworkreply::preConnectEncrypted() void tst_qnetworkreply::preConnectEncrypted_data() { #ifndef QT_NO_OPENSSL - QTest::addColumn<int>("sleepTime"); + QTest::addColumn<std::chrono::milliseconds>("sleepTime"); // start a new normal request after preconnecting is done - QTest::newRow("HTTPS-2secs") << 2000; + QTest::newRow("HTTPS-2secs") << 2000ms; // start a new normal request while preconnecting is in-flight - QTest::newRow("HTTPS-100ms") << 100; + QTest::newRow("HTTPS-100ms") << 100ms; #endif // QT_NO_OPENSSL } @@ -915,9 +917,9 @@ void tst_qnetworkreply::preConnect() manager.clearAccessCache(); // now try to make the connection beforehand - QFETCH(int, sleepTime); + QFETCH(std::chrono::milliseconds, sleepTime); manager.connectToHost(hostName); - QTestEventLoop::instance().enterLoopMSecs(sleepTime); + QTestEventLoop::instance().enterLoop(sleepTime); // now make another request and hopefully use the existing connection QPair<QNetworkReply *, qint64> preConnectResult = runGetRequest(&manager, request); |