diff options
Diffstat (limited to 'tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp')
-rw-r--r-- | tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp | 39 |
1 files changed, 8 insertions, 31 deletions
diff --git a/tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp index c04a0228f9..a28869f24c 100644 --- a/tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -1,31 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Copyright (C) 2021 Alex Trotsenko <alex1973tr@gmail.com> -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite 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$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// Copyright (C) 2021 Alex Trotsenko <alex1973tr@gmail.com> +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QtTest/qtesteventloop.h> @@ -39,6 +14,8 @@ #include <QtNetwork/qlocalsocket.h> #include <QtNetwork/qlocalserver.h> +using namespace std::chrono_literals; + class tst_QLocalSocket : public QObject { Q_OBJECT @@ -200,7 +177,7 @@ void tst_QLocalSocket::dataExchange() QFETCH(int, chunkSize); Q_ASSERT(chunkSize > 0 && connections > 0); - const qint64 timeToTest = 5000; + const auto timeToTest = 5000ms; ServerThread serverThread(chunkSize); serverThread.start(); @@ -216,7 +193,7 @@ void tst_QLocalSocket::dataExchange() Q_UNUSED(channel); totalReceived += bytes; - if (timer.elapsed() >= timeToTest) { + if (timer.elapsed() >= timeToTest.count()) { factory.stopped = true; eventLoop.exitLoop(); } @@ -224,7 +201,7 @@ void tst_QLocalSocket::dataExchange() timer.start(); emit factory.start(); - eventLoop.enterLoopMSecs(timeToTest * 2); + eventLoop.enterLoop(timeToTest * 2); if (!QTest::currentTestFailed()) qDebug("Transfer rate: %.1f MB/s", totalReceived / 1048.576 / timer.elapsed()); |