summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp')
-rw-r--r--tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp41
1 files changed, 9 insertions, 32 deletions
diff --git a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
index 11e17cb319..cc77ba2da3 100644
--- a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
+++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtTest/QTest>
@@ -48,6 +23,8 @@
#include "../../../network-settings.h"
+using namespace std::chrono_literals;
+
class tst_QSocks5SocketEngine : public QObject, public QAbstractSocketEngineReceiver
{
Q_OBJECT
@@ -366,7 +343,7 @@ void tst_QSocks5SocketEngine::simpleErrorsAndStates()
QCOMPARE(socketDevice.state(), QAbstractSocket::UnconnectedState);
QVERIFY(!socketDevice.connectToHost(QHostInfo::fromName(QtNetworkSettings::socksProxyServerName()).addresses().first(), 8088));
QCOMPARE(socketDevice.state(), QAbstractSocket::ConnectingState);
- if (socketDevice.waitForWrite(15000)) {
+ if (socketDevice.waitForWrite(15s)) {
QVERIFY(socketDevice.state() == QAbstractSocket::UnconnectedState ||
socketDevice.state() == QAbstractSocket::ConnectedState);
} else {
@@ -940,13 +917,13 @@ void tst_QSocks5SocketEngine::fragmentation_data()
responses << authMethodBasic << authSuccess.left(1) << authSuccess.mid(1) << connectResponseIPv4;
QTest::newRow("auth-response") << responses;
- for (int i = 1; i < connectResponseIPv4.length() - 1; i++) {
+ for (int i = 1; i < connectResponseIPv4.size() - 1; i++) {
responses.clear();
responses << authMethodNone << connectResponseIPv4.left(i) << connectResponseIPv4.mid(i);
QTest::newRow(qPrintable(QString("connect-response-ipv4-") + QString::number(i))) << responses;
}
- for (int i = 1; i < connectResponseIPv6.length() - 1; i++) {
+ for (int i = 1; i < connectResponseIPv6.size() - 1; i++) {
responses.clear();
responses << authMethodNone << connectResponseIPv6.left(i) << connectResponseIPv6.mid(i);
QTest::newRow(qPrintable(QString("connect-response-ipv6-") + QString::number(i))) << responses;
@@ -989,13 +966,13 @@ void tst_QSocks5SocketEngine::incomplete_data()
responses << authMethodBasic << authSuccess.left(1);
QTest::newRow("auth-response") << responses;
- for (int i = 1; i < connectResponseIPv4.length() - 1; i++) {
+ for (int i = 1; i < connectResponseIPv4.size() - 1; i++) {
responses.clear();
responses << authMethodNone << connectResponseIPv4.left(i);
QTest::newRow(qPrintable(QString("connect-response-ipv4-") + QString::number(i))) << responses;
}
- for (int i = 1; i < connectResponseIPv6.length() - 1; i++) {
+ for (int i = 1; i < connectResponseIPv6.size() - 1; i++) {
responses.clear();
responses << authMethodNone << connectResponseIPv6.left(i);
QTest::newRow(qPrintable(QString("connect-response-ipv6-") + QString::number(i))) << responses;