diff options
Diffstat (limited to 'tests/auto/qhttpnetworkconnection')
-rw-r--r-- | tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro | 3 | ||||
-rw-r--r-- | tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp | 24 |
2 files changed, 16 insertions, 11 deletions
diff --git a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro index bc750c5..e19d962 100644 --- a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro +++ b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro @@ -1,4 +1,7 @@ load(qttest_p4) SOURCES += tst_qhttpnetworkconnection.cpp +INCLUDEPATH += $$(QTDIR)/src/3rdparty/zlib + +requires(contains(QT_CONFIG,private_tests)) QT = core network diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index 661cd22..aa0705d 100644 --- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -42,6 +42,7 @@ #include <QtTest/QtTest> #include "private/qhttpnetworkconnection_p.h" +#include "private/qnoncontiguousbytedevice_p.h" #include <QAuthenticator> #include "../network-settings.h" @@ -243,8 +244,8 @@ void tst_QHttpNetworkConnection::get() QByteArray ba; do { QCoreApplication::instance()->processEvents(); - if (reply->bytesAvailable()) - ba += reply->read(); + while (reply->bytesAvailable()) + ba += reply->readAny(); if (stopWatch.elapsed() >= 30000) break; } while (!reply->isFinished()); @@ -303,8 +304,8 @@ void tst_QHttpNetworkConnection::put() QHttpNetworkRequest request(protocol + host + path, QHttpNetworkRequest::Put); QByteArray array = data.toLatin1(); - QBuffer buffer(&array); - request.setData(&buffer); + QNonContiguousByteDevice *bd = QNonContiguousByteDeviceFactory::create(&array); + request.setUploadByteDevice(bd); finishedCalled = false; finishedWithErrorCalled = false; @@ -326,7 +327,8 @@ void tst_QHttpNetworkConnection::put() if (reply->isFinished()) { QByteArray ba; - ba += reply->read(); + while (reply->bytesAvailable()) + ba += reply->readAny(); } else if(finishedWithErrorCalled) { if(!succeed) { delete reply; @@ -393,8 +395,8 @@ void tst_QHttpNetworkConnection::post() QHttpNetworkRequest request(protocol + host + path, QHttpNetworkRequest::Post); QByteArray array = data.toLatin1(); - QBuffer buffer(&array); - request.setData(&buffer); + QNonContiguousByteDevice *bd = QNonContiguousByteDeviceFactory::create(&array); + request.setUploadByteDevice(bd); QHttpNetworkReply *reply = connection.sendRequest(request); @@ -416,8 +418,8 @@ void tst_QHttpNetworkConnection::post() QByteArray ba; do { QCoreApplication::instance()->processEvents(); - if (reply->bytesAvailable()) - ba += reply->read(); + while (reply->bytesAvailable()) + ba += reply->readAny(); if (stopWatch.elapsed() >= 30000) break; } while (!reply->isFinished()); @@ -615,8 +617,8 @@ void tst_QHttpNetworkConnection::compression() QByteArray ba; do { QCoreApplication::instance()->processEvents(); - if (reply->bytesAvailable()) - ba += reply->read(); + while (reply->bytesAvailable()) + ba += reply->readAny(); if (stopWatch.elapsed() >= 30000) break; } while (!reply->isFinished()); |