summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/socket
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/network/socket')
-rw-r--r--tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp56
-rw-r--r--tests/auto/network/socket/qabstractsocket/tst_qabstractsocket.cpp29
-rw-r--r--tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp50
-rw-r--r--tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp29
-rw-r--r--tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp52
-rw-r--r--tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp62
-rw-r--r--tests/auto/network/socket/qtcpserver/crashingServer/main.cpp29
-rw-r--r--tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp45
-rw-r--r--tests/auto/network/socket/qtcpsocket/stressTest/Test.cpp29
-rw-r--r--tests/auto/network/socket/qtcpsocket/stressTest/Test.h29
-rw-r--r--tests/auto/network/socket/qtcpsocket/stressTest/main.cpp29
-rw-r--r--tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp121
-rw-r--r--tests/auto/network/socket/qudpsocket/clientserver/main.cpp29
-rw-r--r--tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp80
-rw-r--r--tests/auto/network/socket/qudpsocket/udpServer/main.cpp29
15 files changed, 305 insertions, 393 deletions
diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
index 71125f463a..041a0ce16c 100644
--- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
+++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
@@ -1,31 +1,27 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 Intel Corporation.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
@@ -70,16 +66,8 @@ class tst_PlatformSocketEngine : public QObject
{
Q_OBJECT
-public:
- tst_PlatformSocketEngine();
- virtual ~tst_PlatformSocketEngine();
-
-
-public slots:
- void initTestCase();
- void init();
- void cleanup();
private slots:
+ void initTestCase();
void construction();
void simpleConnectToIMAP();
void udpLoopbackTest();
@@ -99,27 +87,11 @@ private slots:
void tooManySockets();
};
-tst_PlatformSocketEngine::tst_PlatformSocketEngine()
-{
-}
-
-tst_PlatformSocketEngine::~tst_PlatformSocketEngine()
-{
-}
-
void tst_PlatformSocketEngine::initTestCase()
{
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
}
-void tst_PlatformSocketEngine::init()
-{
-}
-
-void tst_PlatformSocketEngine::cleanup()
-{
-}
-
//---------------------------------------------------------------------------
void tst_PlatformSocketEngine::construction()
{
diff --git a/tests/auto/network/socket/qabstractsocket/tst_qabstractsocket.cpp b/tests/auto/network/socket/qabstractsocket/tst_qabstractsocket.cpp
index 1c79b6c016..c306308b76 100644
--- a/tests/auto/network/socket/qabstractsocket/tst_qabstractsocket.cpp
+++ b/tests/auto/network/socket/qabstractsocket/tst_qabstractsocket.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** 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:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
diff --git a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp
index f6662b6712..7237542e5c 100644
--- a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp
+++ b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** 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:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
@@ -51,16 +46,9 @@ class tst_QHttpSocketEngine : public QObject
{
Q_OBJECT
-public:
- tst_QHttpSocketEngine();
- virtual ~tst_QHttpSocketEngine();
-
-
-public slots:
+private slots:
void initTestCase();
void init();
- void cleanup();
-private slots:
void construction();
void errorTest_data();
void errorTest();
@@ -132,14 +120,6 @@ public slots:
}
};
-tst_QHttpSocketEngine::tst_QHttpSocketEngine()
-{
-}
-
-tst_QHttpSocketEngine::~tst_QHttpSocketEngine()
-{
-}
-
void tst_QHttpSocketEngine::initTestCase()
{
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
@@ -151,10 +131,6 @@ void tst_QHttpSocketEngine::init()
bytesAvailable = 0;
}
-void tst_QHttpSocketEngine::cleanup()
-{
-}
-
//---------------------------------------------------------------------------
void tst_QHttpSocketEngine::construction()
{
diff --git a/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp b/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp
index 8c2af78295..3f2c8abec4 100644
--- a/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp
+++ b/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** 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:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
index a96c88874e..b5032c8c35 100644
--- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
@@ -1,31 +1,27 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 Intel Corporation.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
@@ -54,9 +50,8 @@ class tst_QLocalSocket : public QObject
{
Q_OBJECT
-public Q_SLOTS:
- void init();
- void cleanup();
+public:
+ tst_QLocalSocket();
private slots:
// basics
@@ -119,7 +114,7 @@ private slots:
};
-void tst_QLocalSocket::init()
+tst_QLocalSocket::tst_QLocalSocket()
{
qRegisterMetaType<QLocalSocket::LocalSocketState>("QLocalSocket::LocalSocketState");
qRegisterMetaType<QLocalSocket::LocalSocketError>("QLocalSocket::LocalSocketError");
@@ -127,10 +122,6 @@ void tst_QLocalSocket::init()
qRegisterMetaType<QFile::Permissions>("QFile::Permissions");
}
-void tst_QLocalSocket::cleanup()
-{
-}
-
class LocalServer : public QLocalServer
{
Q_OBJECT
@@ -193,7 +184,7 @@ private slots:
}
void slotError(QLocalSocket::LocalSocketError newError)
{
- QVERIFY(errorString() != "Unknown error");
+ QVERIFY(errorString() != QLatin1String("Unknown error"));
QCOMPARE(error(), newError);
}
void slotStateChanged(QLocalSocket::LocalSocketState newState)
@@ -331,8 +322,9 @@ void tst_QLocalSocket::listenAndConnect_data()
int connections = i;
if (i == 2)
connections = 5;
- QTest::newRow(QString("null %1").arg(i).toLatin1()) << QString() << false << connections;
- QTest::newRow(QString("tst_localsocket %1").arg(i).toLatin1()) << "tst_localsocket" << true << connections;
+ const QByteArray iB = QByteArray::number(i);
+ QTest::newRow(("null " + iB).constData()) << QString() << false << connections;
+ QTest::newRow(("tst_localsocket " + iB).constData()) << "tst_localsocket" << true << connections;
}
}
@@ -543,7 +535,7 @@ void tst_QLocalSocket::sendData()
if (server.hasPendingConnections()) {
QString testLine = "test";
for (int i = 0; i < 50000; ++i)
- testLine += "a";
+ testLine += QLatin1Char('a');
QLocalSocket *serverSocket = server.nextPendingConnection();
QVERIFY(serverSocket);
QCOMPARE(serverSocket->state(), QLocalSocket::ConnectedState);
@@ -1258,7 +1250,7 @@ void tst_QLocalSocket::verifyListenWithDescriptor()
QVERIFY2(server.fullServerName().at(0) == at, "abstract sockets should start with a '@'");
} else {
QCOMPARE(server.fullServerName(), path);
- if (path.contains(QLatin1String("/"))) {
+ if (path.contains(QLatin1Char('/'))) {
QVERIFY2(server.serverName() == path.mid(path.lastIndexOf(QLatin1Char('/'))+1), "server name invalid short name");
} else {
QVERIFY2(server.serverName() == path, "servier name doesn't match the path provided");
diff --git a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
index 8da656aab7..b4955df107 100644
--- a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
+++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** 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:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
@@ -57,16 +52,9 @@ class tst_QSocks5SocketEngine : public QObject, public QAbstractSocketEngineRece
{
Q_OBJECT
-public:
- tst_QSocks5SocketEngine();
- virtual ~tst_QSocks5SocketEngine();
-
-
-public slots:
+private slots:
void initTestCase();
void init();
- void cleanup();
-private slots:
void construction();
void errorTest_data();
void errorTest();
@@ -160,14 +148,6 @@ private slots:
}
};
-tst_QSocks5SocketEngine::tst_QSocks5SocketEngine()
-{
-}
-
-tst_QSocks5SocketEngine::~tst_QSocks5SocketEngine()
-{
-}
-
void tst_QSocks5SocketEngine::initTestCase()
{
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
@@ -179,10 +159,6 @@ void tst_QSocks5SocketEngine::init()
bytesAvailable = 0;
}
-void tst_QSocks5SocketEngine::cleanup()
-{
-}
-
//---------------------------------------------------------------------------
void tst_QSocks5SocketEngine::construction()
{
@@ -613,8 +589,8 @@ void tst_QSocks5SocketEngine::tcpSocketBlockingTest()
// Read greeting
QVERIFY(socket.waitForReadyRead(5000));
- QString s = socket.readLine();
- QVERIFY2(QtNetworkSettings::compareReplyIMAP(s.toLatin1()), s.toLatin1().constData());
+ QByteArray s = socket.readLine();
+ QVERIFY2(QtNetworkSettings::compareReplyIMAP(s), s.constData());
// Write NOOP
QCOMPARE((int) socket.write("1 NOOP\r\n", 8), 8);
@@ -624,7 +600,7 @@ void tst_QSocks5SocketEngine::tcpSocketBlockingTest()
// Read response
s = socket.readLine();
- QCOMPARE(s.toLatin1().constData(), "1 OK Completed\r\n");
+ QCOMPARE(s, QByteArrayLiteral("1 OK Completed\r\n"));
// Write LOGOUT
QCOMPARE((int) socket.write("2 LOGOUT\r\n", 10), 10);
@@ -634,13 +610,13 @@ void tst_QSocks5SocketEngine::tcpSocketBlockingTest()
// Read two lines of respose
s = socket.readLine();
- QCOMPARE(s.toLatin1().constData(), "* BYE LOGOUT received\r\n");
+ QCOMPARE(s, QByteArrayLiteral("* BYE LOGOUT received\r\n"));
if (!socket.canReadLine())
QVERIFY(socket.waitForReadyRead(5000));
s = socket.readLine();
- QCOMPARE(s.toLatin1().constData(), "2 OK Completed\r\n");
+ QCOMPARE(s, QByteArrayLiteral("2 OK Completed\r\n"));
// Close the socket
socket.close();
@@ -715,7 +691,7 @@ void tst_QSocks5SocketEngine::tcpSocketNonBlockingTest()
// Read response
QVERIFY(!tcpSocketNonBlocking_data.isEmpty());
- QCOMPARE(tcpSocketNonBlocking_data.at(0).toLatin1().constData(), "1 OK Completed\r\n");
+ QCOMPARE(tcpSocketNonBlocking_data.at(0), QLatin1String("1 OK Completed\r\n"));
tcpSocketNonBlocking_data.clear();
diff --git a/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp b/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp
index b53842e6ca..8408e703c0 100644
--- a/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp
+++ b/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** 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:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
index 5df5432cdd..30aab3bf34 100644
--- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** 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:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
@@ -70,17 +65,11 @@ class tst_QTcpServer : public QObject
{
Q_OBJECT
-public:
- tst_QTcpServer();
- virtual ~tst_QTcpServer();
-
-
-public slots:
+private slots:
void initTestCase_data();
void initTestCase();
void init();
void cleanup();
-private slots:
void getSetCheck();
void constructing();
void clientServerLoop();
@@ -138,14 +127,6 @@ void tst_QTcpServer::getSetCheck()
QCOMPARE(INT_MAX, obj1.maxPendingConnections());
}
-tst_QTcpServer::tst_QTcpServer()
-{
-}
-
-tst_QTcpServer::~tst_QTcpServer()
-{
-}
-
void tst_QTcpServer::initTestCase_data()
{
QTest::addColumn<bool>("setProxy");
diff --git a/tests/auto/network/socket/qtcpsocket/stressTest/Test.cpp b/tests/auto/network/socket/qtcpsocket/stressTest/Test.cpp
index ba3ea68d46..407d244f15 100644
--- a/tests/auto/network/socket/qtcpsocket/stressTest/Test.cpp
+++ b/tests/auto/network/socket/qtcpsocket/stressTest/Test.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** 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:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
diff --git a/tests/auto/network/socket/qtcpsocket/stressTest/Test.h b/tests/auto/network/socket/qtcpsocket/stressTest/Test.h
index b7b1f9775f..7839cb2c89 100644
--- a/tests/auto/network/socket/qtcpsocket/stressTest/Test.h
+++ b/tests/auto/network/socket/qtcpsocket/stressTest/Test.h
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** 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:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
diff --git a/tests/auto/network/socket/qtcpsocket/stressTest/main.cpp b/tests/auto/network/socket/qtcpsocket/stressTest/main.cpp
index 146161015a..1948389e37 100644
--- a/tests/auto/network/socket/qtcpsocket/stressTest/main.cpp
+++ b/tests/auto/network/socket/qtcpsocket/stressTest/main.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** 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:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
index cde453c191..7565097942 100644
--- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
@@ -1,31 +1,27 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 Intel Corporation.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
@@ -94,7 +90,6 @@ class tst_QTcpSocket : public QObject
public:
tst_QTcpSocket();
- virtual ~tst_QTcpSocket();
static void enterLoop(int secs)
{
@@ -201,6 +196,8 @@ private slots:
void setSocketOption();
void clientSendDataOnDelayedDisconnect();
void serverDisconnectWithBuffered();
+ void socketDiscardDataInWriteMode();
+ void writeOnReadBufferOverflow();
void readNotificationsAfterBind();
protected slots:
@@ -322,11 +319,6 @@ tst_QTcpSocket::tst_QTcpSocket()
firstFailInfo.setAddresses(QList<QHostAddress>() << QHostAddress("224.0.0.0") << QtNetworkSettings::serverIP());
}
-tst_QTcpSocket::~tst_QTcpSocket()
-{
-
-}
-
void tst_QTcpSocket::initTestCase_data()
{
QTest::addColumn<bool>("setProxy");
@@ -487,6 +479,8 @@ void tst_QTcpSocket::constructing()
QCOMPARE(socket->localAddress(), QHostAddress());
QCOMPARE((int) socket->peerPort(), 0);
QCOMPARE(socket->peerAddress(), QHostAddress());
+ QCOMPARE(socket->readChannelCount(), 0);
+ QCOMPARE(socket->writeChannelCount(), 0);
QCOMPARE(socket->error(), QTcpSocket::UnknownSocketError);
QCOMPARE(socket->errorString(), QString("Unknown error"));
@@ -603,6 +597,8 @@ void tst_QTcpSocket::bind()
} while (randomPort && attemptsLeft);
QCOMPARE(socket->state(), QAbstractSocket::BoundState);
+ QCOMPARE(socket->readChannelCount(), 0);
+ QCOMPARE(socket->writeChannelCount(), 0);
boundPort = socket->localPort();
if (port)
QCOMPARE(int(boundPort), port);
@@ -738,6 +734,8 @@ void tst_QTcpSocket::setSocketDescriptor()
QCOMPARE(socket->socketDescriptor(), (qintptr)sock);
QVERIFY(socket->waitForConnected(10000));
QCOMPARE(socket->socketDescriptor(), (qintptr)sock);
+ QCOMPARE(socket->readChannelCount(), 1);
+ QCOMPARE(socket->writeChannelCount(), 1);
delete socket;
#ifdef Q_OS_WIN
delete dummy;
@@ -773,6 +771,8 @@ void tst_QTcpSocket::blockingIMAP()
QVERIFY(socket->waitForConnected(10000));
QCOMPARE(socket->state(), QTcpSocket::ConnectedState);
QVERIFY(socket->isValid());
+ QCOMPARE(socket->readChannelCount(), 1);
+ QCOMPARE(socket->writeChannelCount(), 1);
// Read greeting
QVERIFY(socket->waitForReadyRead(5000));
@@ -829,6 +829,8 @@ void tst_QTcpSocket::blockingIMAP()
// Check that it's closed
QCOMPARE(socket->state(), QTcpSocket::UnconnectedState);
+ QCOMPARE(socket->readChannelCount(), 0);
+ QCOMPARE(socket->writeChannelCount(), 0);
delete socket;
}
@@ -869,6 +871,8 @@ void tst_QTcpSocket::timeoutConnect()
QVERIFY(!socket->waitForConnected(1000)); //200ms is too short when using SOCKS proxy authentication
QCOMPARE(socket->state(), QTcpSocket::UnconnectedState);
QCOMPARE(int(socket->error()), int(QTcpSocket::SocketTimeoutError));
+ QCOMPARE(socket->readChannelCount(), 0);
+ QCOMPARE(socket->writeChannelCount(), 0);
timer.start();
socket->connectToHost(address, 1357);
@@ -915,6 +919,8 @@ void tst_QTcpSocket::nonBlockingIMAP()
}
QCOMPARE(socket->state(), QTcpSocket::ConnectedState);
+ QCOMPARE(socket->readChannelCount(), 1);
+ QCOMPARE(socket->writeChannelCount(), 1);
enterLoop(30);
if (timeout()) {
@@ -980,6 +986,8 @@ void tst_QTcpSocket::nonBlockingIMAP()
// Check that it's closed
QCOMPARE(socket->state(), QTcpSocket::UnconnectedState);
+ QCOMPARE(socket->readChannelCount(), 0);
+ QCOMPARE(socket->writeChannelCount(), 0);
delete socket;
}
@@ -1776,7 +1784,7 @@ void tst_QTcpSocket::atEnd()
// Test server must use some vsFTPd 2.x.x version
QVERIFY2(greeting.length() == sizeof("220 (vsFTPd 2.x.x)")-1, qPrintable(greeting));
QVERIFY2(greeting.startsWith("220 (vsFTPd 2."), qPrintable(greeting));
- QVERIFY2(greeting.endsWith(")"), qPrintable(greeting));
+ QVERIFY2(greeting.endsWith(QLatin1Char(')')), qPrintable(greeting));
delete socket;
}
@@ -3029,6 +3037,71 @@ void tst_QTcpSocket::serverDisconnectWithBuffered()
delete socket;
}
+// Test buffered sockets discard input when opened in WriteOnly mode
+void tst_QTcpSocket::socketDiscardDataInWriteMode()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ QTcpServer tcpServer;
+ QTcpSocket *socket = newSocket();
+
+ QVERIFY(tcpServer.listen(QHostAddress::LocalHost));
+ socket->connectToHost(tcpServer.serverAddress(), tcpServer.serverPort(),
+ QIODevice::WriteOnly);
+ QVERIFY(socket->waitForConnected(5000)); // ready for write
+ QCOMPARE(socket->state(), QAbstractSocket::ConnectedState);
+
+ // Accept connection on server side
+ QVERIFY2(tcpServer.waitForNewConnection(5000), "Network timeout");
+ QTcpSocket *newConnection = tcpServer.nextPendingConnection();
+ // Send one char and drop link
+ QVERIFY(newConnection != NULL);
+ QVERIFY(newConnection->putChar(0));
+ QVERIFY(newConnection->flush());
+ delete newConnection;
+
+ QVERIFY(socket->waitForReadyRead(5000)); // discard input
+ QVERIFY(socket->atEnd());
+
+ delete socket;
+}
+
+// Test waitForBytesWritten() does not fail on read buffer overflow
+void tst_QTcpSocket::writeOnReadBufferOverflow()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ QTcpServer tcpServer;
+ QTcpSocket *socket = newSocket();
+
+ QVERIFY(tcpServer.listen(QHostAddress::LocalHost));
+ socket->setReadBufferSize(1);
+ socket->connectToHost(tcpServer.serverAddress(), tcpServer.serverPort());
+ QVERIFY(socket->waitForConnected(5000));
+ QCOMPARE(socket->state(), QAbstractSocket::ConnectedState);
+
+ // Accept connection on server side
+ QVERIFY2(tcpServer.waitForNewConnection(5000), "Network timeout");
+ QTcpSocket *newConnection = tcpServer.nextPendingConnection();
+ QVERIFY(newConnection != nullptr);
+ QCOMPARE(newConnection->write("1", 2), Q_INT64_C(2));
+ QVERIFY(newConnection->flush());
+
+ // Wait for buffer overflow
+ QVERIFY(socket->waitForReadyRead(5000));
+ QCOMPARE(socket->bytesAvailable(), Q_INT64_C(1));
+ // Write data and wait for successful send
+ QVERIFY(socket->putChar(0));
+ QVERIFY(socket->waitForBytesWritten(5000));
+
+ delete newConnection;
+ delete socket;
+}
+
// Test that the socket does not enable the read notifications in bind()
void tst_QTcpSocket::readNotificationsAfterBind()
{
diff --git a/tests/auto/network/socket/qudpsocket/clientserver/main.cpp b/tests/auto/network/socket/qudpsocket/clientserver/main.cpp
index db48a0c830..cc3e90671a 100644
--- a/tests/auto/network/socket/qudpsocket/clientserver/main.cpp
+++ b/tests/auto/network/socket/qudpsocket/clientserver/main.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** 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:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
index 0ee3255502..8a0784f4e5 100644
--- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
@@ -1,32 +1,27 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2015 Intel Corporation.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 Intel Corporation.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
@@ -63,17 +58,11 @@ class tst_QUdpSocket : public QObject
{
Q_OBJECT
-public:
- tst_QUdpSocket();
- virtual ~tst_QUdpSocket();
-
-
-public slots:
+private slots:
void initTestCase_data();
void initTestCase();
void init();
void cleanup();
-private slots:
void constructing();
void unconnectedServerAndClientTest();
void broadcasting();
@@ -144,14 +133,6 @@ static QHostAddress makeNonAny(const QHostAddress &address, QHostAddress::Specia
return address;
}
-tst_QUdpSocket::tst_QUdpSocket()
-{
-}
-
-tst_QUdpSocket::~tst_QUdpSocket()
-{
-}
-
void tst_QUdpSocket::initTestCase_data()
{
// hack: we only enable the Socks5 over UDP tests on the old
@@ -1119,12 +1100,13 @@ void tst_QUdpSocket::multicastTtlOption_data()
addresses += QHostAddress(QHostAddress::AnyIPv6);
foreach (const QHostAddress &address, addresses) {
- QTest::newRow(QString("%1 0").arg(address.toString()).toLatin1()) << address << 0 << 0;
- QTest::newRow(QString("%1 1").arg(address.toString()).toLatin1()) << address << 1 << 1;
- QTest::newRow(QString("%1 2").arg(address.toString()).toLatin1()) << address << 2 << 2;
- QTest::newRow(QString("%1 128").arg(address.toString()).toLatin1()) << address << 128 << 128;
- QTest::newRow(QString("%1 255").arg(address.toString()).toLatin1()) << address << 255 << 255;
- QTest::newRow(QString("%1 1024").arg(address.toString()).toLatin1()) << address << 1024 << 1;
+ const QByteArray addressB = address.toString().toLatin1();
+ QTest::newRow((addressB + " 0").constData()) << address << 0 << 0;
+ QTest::newRow((addressB + " 1").constData()) << address << 1 << 1;
+ QTest::newRow((addressB + " 2").constData()) << address << 2 << 2;
+ QTest::newRow((addressB + " 128").constData()) << address << 128 << 128;
+ QTest::newRow((addressB + " 255").constData()) << address << 255 << 255;
+ QTest::newRow((addressB + " 1024").constData()) << address << 1024 << 1;
}
}
@@ -1163,13 +1145,14 @@ void tst_QUdpSocket::multicastLoopbackOption_data()
addresses += QHostAddress(QHostAddress::AnyIPv6);
foreach (const QHostAddress &address, addresses) {
- QTest::newRow(QString("%1 0").arg(address.toString()).toLatin1()) << address << 0 << 0;
- QTest::newRow(QString("%1 1").arg(address.toString()).toLatin1()) << address << 1 << 1;
- QTest::newRow(QString("%1 2").arg(address.toString()).toLatin1()) << address << 2 << 1;
- QTest::newRow(QString("%1 0 again").arg(address.toString()).toLatin1()) << address << 0 << 0;
- QTest::newRow(QString("%1 2 again").arg(address.toString()).toLatin1()) << address << 2 << 1;
- QTest::newRow(QString("%1 0 last time").arg(address.toString()).toLatin1()) << address << 0 << 0;
- QTest::newRow(QString("%1 1 again").arg(address.toString()).toLatin1()) << address << 1 << 1;
+ const QByteArray addressB = address.toString().toLatin1();
+ QTest::newRow((addressB + " 0").constData()) << address << 0 << 0;
+ QTest::newRow((addressB + " 1").constData()) << address << 1 << 1;
+ QTest::newRow((addressB + " 2").constData()) << address << 2 << 1;
+ QTest::newRow((addressB + " 0 again").constData()) << address << 0 << 0;
+ QTest::newRow((addressB + " 2 again").constData()) << address << 2 << 1;
+ QTest::newRow((addressB + " 0 last time").constData()) << address << 0 << 0;
+ QTest::newRow((addressB + " 1 again").constData()) << address << 1 << 1;
}
}
@@ -1266,9 +1249,8 @@ void tst_QUdpSocket::setMulticastInterface_data()
if ((iface.flags() & QNetworkInterface::IsUp) == 0)
continue;
foreach (const QNetworkAddressEntry &entry, iface.addressEntries()) {
- QTest::newRow(QString("%1:%2").arg(iface.name()).arg(entry.ip().toString()).toLatin1())
- << iface
- << entry.ip();
+ const QByteArray testName = iface.name().toLatin1() + ':' + entry.ip().toString().toLatin1();
+ QTest::newRow(testName.constData()) << iface << entry.ip();
}
}
}
diff --git a/tests/auto/network/socket/qudpsocket/udpServer/main.cpp b/tests/auto/network/socket/qudpsocket/udpServer/main.cpp
index 2562e58862..e19e93dc18 100644
--- a/tests/auto/network/socket/qudpsocket/udpServer/main.cpp
+++ b/tests/auto/network/socket/qudpsocket/udpServer/main.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** 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:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**