summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2010-11-04 11:03:03 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2010-11-04 11:03:03 (GMT)
commit447c5812f996b632734fc74ca491422e7cbbed43 (patch)
treedab0597d1d74e0e6e377f3bffdf2315b52058539 /tests
parent445ef8847979dab72893aab1924d46d0fe1a8a3e (diff)
parentab672d88f906b0d6f2d45f9ebbfbf12fdcfba51e (diff)
downloadQt-447c5812f996b632734fc74ca491422e7cbbed43.zip
Qt-447c5812f996b632734fc74ca491422e7cbbed43.tar.gz
Qt-447c5812f996b632734fc74ca491422e7cbbed43.tar.bz2
Merge branch '4.7-upstream' into 4.7-water
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 5196ed2..8850e6e 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -295,6 +295,8 @@ private Q_SLOTS:
void getFromUnreachableIp();
+ void qtbug4121unknownAuthentication();
+
// NOTE: This test must be last!
void parentingRepliesToTheApp();
};
@@ -4598,6 +4600,7 @@ void tst_QNetworkReply::qtbug12908compressedHttpReply()
QCOMPARE(reply->error(), QNetworkReply::NoError);
}
+// TODO add similar test for FTP
void tst_QNetworkReply::getFromUnreachableIp()
{
QNetworkAccessManager manager;
@@ -4612,6 +4615,35 @@ void tst_QNetworkReply::getFromUnreachableIp()
QVERIFY(reply->error() != QNetworkReply::NoError);
}
+void tst_QNetworkReply::qtbug4121unknownAuthentication()
+{
+ MiniHttpServer server(QByteArray("HTTP/1.1 401 bla\r\nWWW-Authenticate: crap\r\nContent-Length: 0\r\n\r\n"));
+ server.doClose = false;
+
+ QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort())));
+ QNetworkAccessManager manager;
+ QNetworkReplyPtr reply = manager.get(request);
+
+ qRegisterMetaType<QNetworkReply*>("QNetworkReply*");
+ qRegisterMetaType<QAuthenticator*>("QAuthenticator*");
+ QSignalSpy authSpy(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)));
+ QSignalSpy finishedSpy(&manager, SIGNAL(finished(QNetworkReply*)));
+ qRegisterMetaType<QNetworkReply::NetworkError>("QNetworkReply::NetworkError");
+ QSignalSpy errorSpy(reply, SIGNAL(error(QNetworkReply::NetworkError)));
+
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QCOMPARE(authSpy.count(), 0);
+ QCOMPARE(finishedSpy.count(), 1);
+ QCOMPARE(errorSpy.count(), 1);
+
+ QCOMPARE(reply->error(), QNetworkReply::AuthenticationRequiredError);
+}
+
+
+
// NOTE: This test must be last testcase in tst_qnetworkreply!
void tst_QNetworkReply::parentingRepliesToTheApp()
{