diff options
author | Shane Kearns <ext-shane.2.kearns@nokia.com> | 2012-02-14 20:12:42 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-15 19:03:45 (GMT) |
commit | 6c4c5709a3f6150c4e37f38c7e7fd980ab359a53 (patch) | |
tree | a23e47cae9a0cc0e5b7213c956f9cf43779d905e /tests | |
parent | af8a22c53a095031c6d363882da373d2173201f5 (diff) | |
download | Qt-6c4c5709a3f6150c4e37f38c7e7fd980ab359a53.zip Qt-6c4c5709a3f6150c4e37f38c7e7fd980ab359a53.tar.gz Qt-6c4c5709a3f6150c4e37f38c7e7fd980ab359a53.tar.bz2 |
Abort FTP download, not the whole application
An old coding error meant that the C runtime abort() function was
being called instead of QFtp::abort() when cancelling an FTP download
using QNetworkReply::close()
Task-number: QTBUG-22820
Change-Id: Ib97fda9769b2b55a08c042c66c4444cb6216d2b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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() { |