diff options
Diffstat (limited to 'tests/auto/network/access')
24 files changed, 239 insertions, 381 deletions
diff --git a/tests/auto/network/access/qabstractnetworkcache/BLACKLIST b/tests/auto/network/access/qabstractnetworkcache/BLACKLIST index 3bd3350e4b..2ad52f8b31 100644 --- a/tests/auto/network/access/qabstractnetworkcache/BLACKLIST +++ b/tests/auto/network/access/qabstractnetworkcache/BLACKLIST @@ -1,9 +1,2 @@ [cacheControl] windows -osx -[expires] -osx -[etag] -osx -[lastModified] -osx diff --git a/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro b/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro index 4772af9af9..1874f001ab 100644 --- a/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro +++ b/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qabstractnetworkcache QT = core network testlib SOURCES += tst_qabstractnetworkcache.cpp diff --git a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index fd48ec3253..0da42b8b87 100644 --- a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.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$ ** @@ -44,7 +39,7 @@ #include <algorithm> -#define TESTFILE QString("http://%1/qtest/cgi-bin/").arg(QtNetworkSettings::serverName()) +#define TESTFILE QLatin1String("http://") + QtNetworkSettings::serverName() + QLatin1String("/qtest/cgi-bin/") class tst_QAbstractNetworkCache : public QObject { diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index 795548ccc8..eca913fe08 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.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$ ** @@ -63,16 +58,13 @@ class tst_QFtp : public QObject public: tst_QFtp(); - virtual ~tst_QFtp(); - -public slots: +private slots: void initTestCase_data(); void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); -private slots: void connectToHost_data(); void connectToHost(); void connectToUnresponsiveHost(); @@ -187,10 +179,6 @@ tst_QFtp::tst_QFtp() : { } -tst_QFtp::~tst_QFtp() -{ -} - void tst_QFtp::initTestCase_data() { QTest::addColumn<bool>("setProxy"); @@ -290,10 +278,11 @@ void tst_QFtp::init() #if !defined(Q_OS_WINCE) srand(time(0)); - uniqueExtension = QString("%1%2%3").arg((qulonglong)this).arg(rand()).arg((qulonglong)time(0)); + uniqueExtension = QString::number((quintptr)this) + QString::number(rand()) + + QString::number((qulonglong)time(0)); #else srand(0); - uniqueExtension = QString("%1%2%3").arg((qulonglong)this).arg(rand()).arg((qulonglong)(0)); + uniqueExtension = QString::number((quintptr)this) + QString::number(rand()) + QLatin1Char('0'); #endif } @@ -643,19 +632,20 @@ void tst_QFtp::get_data() // test the two get() overloads in one routine for ( int i=0; i<2; i++ ) { - QTest::newRow( QString("relPath01_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() + const QByteArray iB = QByteArray::number(i); + QTest::newRow(("relPath01_" + iB).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() << "qtest/rfc3252" << 1 << rfc3252 << (bool)(i==1); - QTest::newRow( QString("relPath02_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString("ftptest") << QString("password") + QTest::newRow(("relPath02_" + iB).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString("ftptest") << QString("password") << "qtest/rfc3252" << 1 << rfc3252 << (bool)(i==1); - QTest::newRow( QString("absPath01_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() + QTest::newRow(("absPath01_" + iB).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() << "/qtest/rfc3252" << 1 << rfc3252 << (bool)(i==1); - QTest::newRow( QString("absPath02_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString("ftptest") << QString("password") + QTest::newRow(("absPath02_" + iB).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString("ftptest") << QString("password") << "/var/ftp/qtest/rfc3252" << 1 << rfc3252 << (bool)(i==1); - QTest::newRow( QString("nonExist01_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() + QTest::newRow(("nonExist01_" + iB).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() << QString("foo") << 0 << QByteArray() << (bool)(i==1); - QTest::newRow( QString("nonExist02_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() + QTest::newRow(("nonExist02_" + iB).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() << QString("/foo") << 0 << QByteArray() << (bool)(i==1); } } @@ -734,7 +724,7 @@ void tst_QFtp::put_data() // test the two put() overloads in one routine for ( int i=0; i<2; i++ ) { - QTest::newRow( QString("relPath01_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() + QTest::newRow(("relPath01_" + QByteArray::number(i)).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() << QString("qtest/upload/rel01_%1") << rfc3252 << (bool)(i==1) << 1; /* @@ -2048,10 +2038,10 @@ bool tst_QFtp::dirExists( const QString &host, quint16 port, const QString &user addCommand( QFtp::ConnectToHost, ftp->connectToHost( host, port ) ); addCommand( QFtp::Login, ftp->login( user, password ) ); - if ( dirToCreate.startsWith( "/" ) ) + if ( dirToCreate.startsWith( QLatin1Char('/') ) ) addCommand( QFtp::Cd, ftp->cd( dirToCreate ) ); else - addCommand( QFtp::Cd, ftp->cd( cdDir + "/" + dirToCreate ) ); + addCommand( QFtp::Cd, ftp->cd( cdDir + QLatin1Char('/') + dirToCreate ) ); addCommand( QFtp::Close, ftp->close() ); inFileDirExistsFunction = true; diff --git a/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro index fa19fa7ac9..bd20fd33dd 100644 --- a/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro +++ b/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qhttpnetworkconnection SOURCES += tst_qhttpnetworkconnection.cpp requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index 0d188a8fec..ef742aaa9a 100644 --- a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.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$ ** @@ -44,9 +39,6 @@ class tst_QHttpNetworkConnection: public QObject { Q_OBJECT -public: - tst_QHttpNetworkConnection(); - public Q_SLOTS: void finishedReply(); void finishedWithError(QNetworkReply::NetworkError errorCode, const QString &detail); @@ -60,11 +52,7 @@ private: QNetworkReply::NetworkError netErrorCode; private Q_SLOTS: - void init(); - void cleanup(); void initTestCase(); - void cleanupTestCase(); - void options_data(); void options(); void get_data(); @@ -111,27 +99,11 @@ private Q_SLOTS: void overlappingCloseAndWrite(); }; -tst_QHttpNetworkConnection::tst_QHttpNetworkConnection() -{ -} - void tst_QHttpNetworkConnection::initTestCase() { QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); } -void tst_QHttpNetworkConnection::cleanupTestCase() -{ -} - -void tst_QHttpNetworkConnection::init() -{ -} - -void tst_QHttpNetworkConnection::cleanup() -{ -} - void tst_QHttpNetworkConnection::options_data() { // not tested yet diff --git a/tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro b/tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro index f5dbc7f010..1810a38f6e 100644 --- a/tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro +++ b/tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qhttpnetworkreply SOURCES += tst_qhttpnetworkreply.cpp requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp index 231c2de4cb..ec965a61b2 100644 --- a/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp +++ b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.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$ ** @@ -42,11 +37,6 @@ class tst_QHttpNetworkReply: public QObject { Q_OBJECT private Q_SLOTS: - void init(); - void cleanup(); - void initTestCase(); - void cleanupTestCase(); - void parseHeader_data(); void parseHeader(); @@ -54,23 +44,6 @@ private Q_SLOTS: void parseEndOfHeader(); }; - -void tst_QHttpNetworkReply::initTestCase() -{ -} - -void tst_QHttpNetworkReply::cleanupTestCase() -{ -} - -void tst_QHttpNetworkReply::init() -{ -} - -void tst_QHttpNetworkReply::cleanup() -{ -} - void tst_QHttpNetworkReply::parseHeader_data() { QTest::addColumn<QByteArray>("headers"); diff --git a/tests/auto/network/access/qnetworkaccessmanager/qnetworkaccessmanager.pro b/tests/auto/network/access/qnetworkaccessmanager/qnetworkaccessmanager.pro index 8b3de90f54..e84f9f7dba 100644 --- a/tests/auto/network/access/qnetworkaccessmanager/qnetworkaccessmanager.pro +++ b/tests/auto/network/access/qnetworkaccessmanager/qnetworkaccessmanager.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkaccessmanager SOURCES += tst_qnetworkaccessmanager.cpp QT = core network testlib diff --git a/tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp b/tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp index 8ecb57dd33..bc2e2822cb 100644 --- a/tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp +++ b/tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.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/access/qnetworkcachemetadata/qnetworkcachemetadata.pro b/tests/auto/network/access/qnetworkcachemetadata/qnetworkcachemetadata.pro index d308c286fb..0e942cd4f4 100644 --- a/tests/auto/network/access/qnetworkcachemetadata/qnetworkcachemetadata.pro +++ b/tests/auto/network/access/qnetworkcachemetadata/qnetworkcachemetadata.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkcachemetadata QT = core network testlib SOURCES += tst_qnetworkcachemetadata.cpp diff --git a/tests/auto/network/access/qnetworkcachemetadata/tst_qnetworkcachemetadata.cpp b/tests/auto/network/access/qnetworkcachemetadata/tst_qnetworkcachemetadata.cpp index c33644cfad..49c3f1b17f 100644 --- a/tests/auto/network/access/qnetworkcachemetadata/tst_qnetworkcachemetadata.cpp +++ b/tests/auto/network/access/qnetworkcachemetadata/tst_qnetworkcachemetadata.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$ ** @@ -41,12 +36,6 @@ class tst_QNetworkCacheMetaData : public QObject { Q_OBJECT -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: void qnetworkcachemetadata_data(); void qnetworkcachemetadata(); @@ -76,28 +65,6 @@ class SubQNetworkCacheMetaData : public QNetworkCacheMetaData { public:}; -// This will be called before the first test function is executed. -// It is only called once. -void tst_QNetworkCacheMetaData::initTestCase() -{ -} - -// This will be called after the last test function is executed. -// It is only called once. -void tst_QNetworkCacheMetaData::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_QNetworkCacheMetaData::init() -{ -} - -// This will be called after every test function. -void tst_QNetworkCacheMetaData::cleanup() -{ -} - void tst_QNetworkCacheMetaData::qnetworkcachemetadata_data() { } diff --git a/tests/auto/network/access/qnetworkcookie/qnetworkcookie.pro b/tests/auto/network/access/qnetworkcookie/qnetworkcookie.pro index ba3ece8576..320e3a81c5 100644 --- a/tests/auto/network/access/qnetworkcookie/qnetworkcookie.pro +++ b/tests/auto/network/access/qnetworkcookie/qnetworkcookie.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkcookie SOURCES += tst_qnetworkcookie.cpp diff --git a/tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.cpp b/tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.cpp index be3e839725..0424fc47ed 100644 --- a/tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.cpp +++ b/tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.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$ ** @@ -63,16 +58,16 @@ namespace QTest { template<> char *toString(const QList<QNetworkCookie> &list) { - QString result = "QList("; + QByteArray result = "QList("; bool first = true; foreach (QNetworkCookie cookie, list) { if (!first) result += ", "; first = false; - result += QString::fromLatin1("QNetworkCookie(%1)").arg(QLatin1String(cookie.toRawForm())); + result += "QNetworkCookie(" + cookie.toRawForm() + ')'; } - - return qstrdup(result.append(')').toLocal8Bit()); + result.append(')'); + return qstrdup(result.constData()); } } diff --git a/tests/auto/network/access/qnetworkcookiejar/qnetworkcookiejar.pro b/tests/auto/network/access/qnetworkcookiejar/qnetworkcookiejar.pro index bb39f83af6..e679f8a930 100644 --- a/tests/auto/network/access/qnetworkcookiejar/qnetworkcookiejar.pro +++ b/tests/auto/network/access/qnetworkcookiejar/qnetworkcookiejar.pro @@ -1,6 +1,6 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkcookiejar SOURCES += tst_qnetworkcookiejar.cpp QT = core core-private network network-private testlib +TESTDATA = parser.json diff --git a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp index 12ac1e519d..8a1a5b8369 100644 --- a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp +++ b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.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$ ** @@ -72,16 +67,17 @@ namespace QTest { template<> char *toString(const QList<QNetworkCookie> &list) { - QString result = "QList("; + QByteArray result = "QList("; bool first = true; foreach (QNetworkCookie cookie, list) { if (!first) result += ", "; first = false; - result += QString::fromLatin1("QNetworkCookie(%1)").arg(QLatin1String(cookie.toRawForm())); + result += "QNetworkCookie(" + cookie.toRawForm() + ')'; } - return qstrdup(result.append(')').toLocal8Bit()); + result.append(')'); + return qstrdup(result.constData()); } } diff --git a/tests/auto/network/access/qnetworkdiskcache/qnetworkdiskcache.pro b/tests/auto/network/access/qnetworkdiskcache/qnetworkdiskcache.pro index 7e26abbe08..4a78544bf8 100644 --- a/tests/auto/network/access/qnetworkdiskcache/qnetworkdiskcache.pro +++ b/tests/auto/network/access/qnetworkdiskcache/qnetworkdiskcache.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkdiskcache QT = core network testlib SOURCES += tst_qnetworkdiskcache.cpp diff --git a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp index 1685838e9e..af6f2d0e10 100644 --- a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp +++ b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.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$ ** @@ -50,14 +45,12 @@ public: tst_QNetworkDiskCache(); public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); void accessAfterRemoveReadyReadSlot(); void setCookieHeaderMetaDataChangedSlot(); private slots: + void initTestCase(); + void cleanupTestCase(); void qnetworkdiskcache_data(); void qnetworkdiskcache(); @@ -202,16 +195,6 @@ void tst_QNetworkDiskCache::cleanupTestCase() workingDir.removeRecursively(); } -// This will be called before each test function is executed. -void tst_QNetworkDiskCache::init() -{ -} - -// This will be called after every test function. -void tst_QNetworkDiskCache::cleanup() -{ -} - void tst_QNetworkDiskCache::qnetworkdiskcache_data() { } @@ -540,7 +523,7 @@ void tst_QNetworkDiskCache::expire() std::sort(cacheList.begin(), cacheList.end()); for (int i = 0; i < cacheList.count(); ++i) { QString fileName = cacheList[i]; - QCOMPARE(fileName, QString("http://localhost:4/%1").arg(i + 6)); + QCOMPARE(fileName, QLatin1String("http://localhost:4/") + QString::number(i + 6)); } } @@ -782,7 +765,10 @@ void tst_QNetworkDiskCache::crashWhenParentingCache() QNetworkAccessManager *manager = new QNetworkAccessManager(); QNetworkDiskCache *diskCache = new QNetworkDiskCache(manager); // parent to qnam! // we expect the temp dir to be cleaned at some point anyway - diskCache->setCacheDirectory(QString("%1/cacheDir_%2").arg(QDir::tempPath()).arg(QCoreApplication::applicationPid())); + + const QString diskCachePath = QDir::tempPath() + QLatin1String("/cacheDir_") + + QString::number(QCoreApplication::applicationPid()); + diskCache->setCacheDirectory(diskCachePath); manager->setCache(diskCache); QUrl url("http://127.0.0.1:" + QString::number(server.serverPort())); diff --git a/tests/auto/network/access/qnetworkreply/echo/main.cpp b/tests/auto/network/access/qnetworkreply/echo/main.cpp index 877ffbb5d4..9085de7898 100644 --- a/tests/auto/network/access/qnetworkreply/echo/main.cpp +++ b/tests/auto/network/access/qnetworkreply/echo/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/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index ce56dcacba..bd9f3a5b72 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.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$ ** @@ -125,9 +120,10 @@ class tst_QNetworkReply: public QObject qsrand(QTime(0,0,0).msecsTo(QTime::currentTime()) + QCoreApplication::applicationPid()); seedCreated = true; // not thread-safe, but who cares } - QString s = QString("%1-%2-%3").arg(QTime(0,0,0).msecsTo(QTime::currentTime())).arg(QCoreApplication::applicationPid()).arg(qrand()); - return s; - }; + return QString::number(QTime(0, 0, 0).msecsTo(QTime::currentTime())) + + QLatin1Char('-') + QString::number(QCoreApplication::applicationPid()) + + QLatin1Char('-') + QString::number(qrand()); + } static QString tempRedirectReplyStr() { QString s = "HTTP/1.1 307 Temporary Redirect\r\n" @@ -198,6 +194,7 @@ public Q_SLOTS: protected Q_SLOTS: void nestedEventLoops_slot(); + void notEnoughData(); private Q_SLOTS: void cleanup() { cleanupTestData(); } @@ -487,6 +484,7 @@ private: void cleanupTestData(); QString testDataDir; + bool notEnoughDataForFastSender; }; bool tst_QNetworkReply::seedCreated = false; @@ -515,16 +513,16 @@ namespace QTest { template<> char *toString(const QList<QNetworkCookie> &list) { - QString result = "QList("; + QByteArray result = "QList("; bool first = true; foreach (QNetworkCookie cookie, list) { if (!first) result += ", "; first = false; - result += QString::fromLatin1("QNetworkCookie(%1)").arg(QLatin1String(cookie.toRawForm())); + result += "QNetworkCookie(" + cookie.toRawForm() + ')'; } - - return qstrdup(result.append(')').toLocal8Bit()); + result.append(')'); + return qstrdup(result.constData()); } } @@ -991,11 +989,13 @@ public: } // a server that sends the data provided at construction time, useful for HTTP - FastSender(const QByteArray& data, bool https, bool fillBuffer) + FastSender(const QByteArray& data, bool https, bool fillBuffer, tst_QNetworkReply *listener = 0) : wantedSize(data.size()), port(-1), protocol(ProvidedData), doSsl(https), fillKernelBuffer(fillBuffer), transferRate(-1), dataToTransmit(data), dataIndex(0) { + if (listener) + connect(this, SIGNAL(notEnoughData()), listener, SLOT(notEnoughData())); start(); ready.acquire(); } @@ -1058,6 +1058,7 @@ protected: do { if (writeNextData(client, BlockSize) < BlockSize) { qDebug() << "ERROR: FastSender: not enough data to write in order to fill buffers; or client is reading too fast"; + emit notEnoughData(); return; } while (client->bytesToWrite() > 0) { @@ -1118,6 +1119,7 @@ protected: } signals: void dataReady(); + void notEnoughData(); }; class RateControlledReader: public QObject @@ -2778,7 +2780,7 @@ void tst_QNetworkReply::postToHttpsMultipart() // hack for testing the setting of the content-type header by hand: if (contentType == "custom") { - QByteArray contentType("multipart/custom; boundary=\"" + multiPart->boundary() + "\""); + QByteArray contentType("multipart/custom; boundary=\"" + multiPart->boundary() + '"'); request.setHeader(QNetworkRequest::ContentTypeHeader, contentType); } @@ -2930,7 +2932,7 @@ void tst_QNetworkReply::connectToIPv6Address() QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply)); QByteArray content = reply->readAll(); //qDebug() << server.receivedData; - QByteArray hostinfo = "\r\nHost: " + hostfield + ":" + QByteArray::number(server.serverPort()) + "\r\n"; + QByteArray hostinfo = "\r\nHost: " + hostfield + ':' + QByteArray::number(server.serverPort()) + "\r\n"; QVERIFY(server.receivedData.contains(hostinfo)); QCOMPARE(content, dataToSend); QCOMPARE(reply->url(), request.url()); @@ -4814,7 +4816,7 @@ void tst_QNetworkReply::ioPostToHttpsUploadProgress() server.listen(QHostAddress(QHostAddress::LocalHost), 0); // create the request - QUrl url = QUrl(QString("https://127.0.0.1:%1/").arg(server.serverPort())); + QUrl url = QUrl(QLatin1String("https://127.0.0.1:") + QString::number(server.serverPort()) + QLatin1Char('/')); QNetworkRequest request(url); request.setRawHeader("Content-Type", "application/octet-stream"); @@ -4898,7 +4900,8 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp() << testData.size() << "bytes of data"; const bool fillKernelBuffer = bufferSize > 0; - FastSender server(httpResponse, https, fillKernelBuffer); + notEnoughDataForFastSender = false; + FastSender server(httpResponse, https, fillKernelBuffer, this); QUrl url(QString("%1://127.0.0.1:%2/qtest/rfc3252.txt") .arg(https?"https":"http") @@ -4913,7 +4916,13 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp() QTime loopTime; loopTime.start(); - QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply)); + const int result = waitForFinish(reply); + if (notEnoughDataForFastSender) { + server.wait(); + QSKIP("kernel socket buffers are too big for this test to work"); + } + + QVERIFY2(result == Success, msgWaitForFinished(reply)); const int elapsedTime = loopTime.elapsed(); server.wait(); @@ -4941,7 +4950,7 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp() const int allowedDeviation = 16; // TODO find out why the send rate is 13% faster currently const int minRate = rate * 1024 * (100-allowedDeviation) / 100; const int maxRate = rate * 1024 * (100+allowedDeviation) / 100; - qDebug() << minRate << "<="<< server.transferRate << "<=" << maxRate << "?"; + qDebug() << minRate << "<="<< server.transferRate << "<=" << maxRate << '?'; // The test takes too long to run if sending enough data to overwhelm the // reciever's kernel buffers. //QEXPECT_FAIL("http+limited", "Limiting is broken right now, check QTBUG-15065", Continue); @@ -5030,7 +5039,7 @@ void tst_QNetworkReply::emitAllUploadProgressSignals() server.listen(QHostAddress(QHostAddress::LocalHost), 0); connect(&server, SIGNAL(newConnection()), &QTestEventLoop::instance(), SLOT(exitLoop())); - QUrl url = QUrl(QString("http://127.0.0.1:%1/").arg(server.serverPort())); + QUrl url = QUrl(QLatin1String("http://127.0.0.1:") + QString::number(server.serverPort()) + QLatin1Char('/')); QNetworkRequest normalRequest(url); normalRequest.setRawHeader("Content-Type", "application/octet-stream"); @@ -5085,7 +5094,7 @@ void tst_QNetworkReply::ioPostToHttpEmptyUploadProgress() server.listen(QHostAddress(QHostAddress::LocalHost), 0); // create the request - QUrl url = QUrl(QString("http://127.0.0.1:%1/").arg(server.serverPort())); + QUrl url = QUrl(QLatin1String("http://127.0.0.1:") + QString::number(server.serverPort()) + QLatin1Char('/')); QNetworkRequest request(url); request.setRawHeader("Content-Type", "application/octet-stream"); QNetworkReplyPtr reply(manager.post(request, &buffer)); @@ -5517,7 +5526,7 @@ void tst_QNetworkReply::sendCookies_data() list.clear(); cookie = QNetworkCookie("a", "b"); cookie.setPath("/"); - cookie.setDomain("." + QtNetworkSettings::serverDomainName()); + cookie.setDomain(QLatin1Char('.') + QtNetworkSettings::serverDomainName()); list << cookie; QTest::newRow("domain-match") << list << "a=b"; @@ -5586,6 +5595,11 @@ void tst_QNetworkReply::nestedEventLoops_slot() QTestEventLoop::instance().exitLoop(); } +void tst_QNetworkReply::notEnoughData() +{ + notEnoughDataForFastSender = true; +} + void tst_QNetworkReply::nestedEventLoops() { // Slightly fragile test, it may not be testing anything @@ -5850,7 +5864,7 @@ void tst_QNetworkReply::httpConnectionCount() QCoreApplication::instance()->processEvents(); for (int i = 0; i < 10; i++) { - QNetworkRequest request (QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/" + QString::number(i))); + QNetworkRequest request (QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + QLatin1Char('/') + QString::number(i))); QNetworkReply* reply = manager.get(request); reply->setParent(&server); } @@ -6463,9 +6477,10 @@ public slots: QByteArray data(amount, '@'); if (chunkedEncoding) { - client->write(QString(QString("%1").arg(amount,0,16).toUpper() + "\r\n").toLatin1()); + client->write(QByteArray::number(amount, 16).toUpper()); + client->write("\r\n"); client->write(data.constData(), amount); - client->write(QString("\r\n").toLatin1()); + client->write("\r\n"); } else { client->write(data.constData(), amount); } @@ -7734,6 +7749,7 @@ void tst_QNetworkReply::emitErrorForAllReplies() // QTBUG-36890 #ifdef QT_BUILD_INTERNAL void tst_QNetworkReply::backgroundRequest_data() { +#ifndef QT_NO_BEARERMANAGEMENT QTest::addColumn<QUrl>("url"); QTest::addColumn<bool>("background"); QTest::addColumn<int>("policy"); @@ -7759,7 +7775,7 @@ void tst_QNetworkReply::backgroundRequest_data() QTest::newRow("ftp, bg, normal") << ftpurl << true << (int)QNetworkSession::NoPolicy << QNetworkReply::NoError; QTest::newRow("ftp, fg, nobg") << ftpurl << false << (int)QNetworkSession::NoBackgroundTrafficPolicy << QNetworkReply::NoError; QTest::newRow("ftp, bg, nobg") << ftpurl << true << (int)QNetworkSession::NoBackgroundTrafficPolicy << QNetworkReply::BackgroundRequestNotAllowedError; - +#endif // !QT_NO_BEARERMANAGEMENT } #endif @@ -8296,10 +8312,15 @@ void tst_QNetworkReply::putWithServerClosingConnectionImmediately() server.m_expectedReplies = numUploads; server.listen(QHostAddress(QHostAddress::LocalHost), 0); + QString urlPrefix = QLatin1String("http"); + if (withSsl) + urlPrefix += QLatin1Char('s'); + urlPrefix += QLatin1String("://127.0.0.1:"); + urlPrefix += QString::number(server.serverPort()); + urlPrefix += QLatin1String("/file="); for (int i = 0; i < numUploads; i++) { // create the request - QUrl url = QUrl(QString("http%1://127.0.0.1:%2/file=%3").arg(withSsl ? "s" : "").arg(server.serverPort()).arg(i)); - QNetworkRequest request(url); + QNetworkRequest request(QUrl(urlPrefix + QString::number(i))); QNetworkReply *reply = manager.put(request, sourceFile); connect(reply, SIGNAL(sslErrors(QList<QSslError>)), reply, SLOT(ignoreSslErrors())); connect(reply, SIGNAL(finished()), &server, SLOT(replyFinished())); diff --git a/tests/auto/network/access/qnetworkrequest/qnetworkrequest.pro b/tests/auto/network/access/qnetworkrequest/qnetworkrequest.pro index 0470d96b8c..c00c2c30a2 100644 --- a/tests/auto/network/access/qnetworkrequest/qnetworkrequest.pro +++ b/tests/auto/network/access/qnetworkrequest/qnetworkrequest.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkrequest SOURCES += tst_qnetworkrequest.cpp diff --git a/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp b/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp index 7370339b2b..a14aaf3cb1 100644 --- a/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp +++ b/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.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$ ** @@ -73,16 +68,16 @@ namespace QTest { template<> char *toString(const QList<QNetworkCookie> &list) { - QString result = "QList("; + QByteArray result = "QList("; bool first = true; foreach (QNetworkCookie cookie, list) { if (!first) result += ", "; first = false; - result += QString::fromLatin1("QNetworkCookie(%1)").arg(QLatin1String(cookie.toRawForm())); + result += "QNetworkCookie(" + cookie.toRawForm() + ')'; } - - return qstrdup(result.append(')').toLocal8Bit()); + result.append(')'); + return qstrdup(result.constData()); } } diff --git a/tests/auto/network/access/spdy/spdy.pro b/tests/auto/network/access/spdy/spdy.pro index 23efa85b47..cdbe60a19b 100644 --- a/tests/auto/network/access/spdy/spdy.pro +++ b/tests/auto/network/access/spdy/spdy.pro @@ -1,9 +1,7 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_spdy SOURCES += tst_spdy.cpp QT = core core-private network network-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 win32:CONFIG += insignificant_test # QTBUG-47128 diff --git a/tests/auto/network/access/spdy/tst_spdy.cpp b/tests/auto/network/access/spdy/tst_spdy.cpp index cd98aa8a25..f4a5976558 100644 --- a/tests/auto/network/access/spdy/tst_spdy.cpp +++ b/tests/auto/network/access/spdy/tst_spdy.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2014 BlackBerry Limited. All rights reserved. -** Contact: http://www.qt.io/licensing/ +** 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$ ** |