diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index b6a0196..53835d8 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -386,6 +386,9 @@ private Q_SLOTS: void synchronousAuthenticationCache(); void pipelining(); + void closeDuringDownload_data(); + void closeDuringDownload(); + // NOTE: This test must be last! void parentingRepliesToTheApp(); }; @@ -6703,6 +6706,27 @@ void tst_QNetworkReply::pipeliningHelperSlot() { } } +void tst_QNetworkReply::closeDuringDownload_data() +{ + QTest::addColumn<QUrl>("url"); + QTest::newRow("http") << QUrl("http://" + QtNetworkSettings::serverName() + "/bigfile"); + QTest::newRow("ftp") << QUrl("ftp://" + QtNetworkSettings::serverName() + "/qtest/bigfile"); +} + +void tst_QNetworkReply::closeDuringDownload() +{ + QFETCH(QUrl, url); + QNetworkRequest request(url); + QNetworkReply* reply = manager.get(request); + connect(reply, SIGNAL(readyRead()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + reply->close(); + reply->deleteLater(); + QTest::qWait(1000); //cancelling ftp takes some time, this avoids a warning caused by test's cleanup() destroying the connection cache before the abort is finished +} + // NOTE: This test must be last testcase in tst_qnetworkreply! void tst_QNetworkReply::parentingRepliesToTheApp() { |