diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-02-07 17:20:33 +0000 |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2011-02-07 17:20:33 +0000 |
commit | 59a9938f91070ad3699fc6544848f0955ecf0bdd (patch) | |
tree | 99ad7312ddddf7233290115c7ea5daa3af0b83ec /tests/auto/qnetworkreply | |
parent | b9307547c717606e08661cf474eeaf81cc0789e6 (diff) | |
parent | 44298c848ac254fe1942eb32eed7651dec5bf0e3 (diff) | |
download | qt4-tools-59a9938f91070ad3699fc6544848f0955ecf0bdd.tar.gz |
Merge remote branch 'qt/master' into symbian-socket-engine
Conflicts:
src/network/access/qnetworkaccessmanager.cpp
src/network/bearer/qnetworksession.cpp
src/network/kernel/qnetworkproxy_symbian.cpp
src/network/socket/qnativesocketengine_unix.cpp
tests/auto/platformsocketengine/tst_platformsocketengine.cpp
Diffstat (limited to 'tests/auto/qnetworkreply')
-rw-r--r-- | tests/auto/qnetworkreply/echo/main.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 34 |
2 files changed, 24 insertions, 12 deletions
diff --git a/tests/auto/qnetworkreply/echo/main.cpp b/tests/auto/qnetworkreply/echo/main.cpp index 14a3462676..f2d8256193 100644 --- a/tests/auto/qnetworkreply/echo/main.cpp +++ b/tests/auto/qnetworkreply/echo/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 71a8352fb6..4d42706c51 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -224,6 +224,7 @@ private Q_SLOTS: void ioGetFromBuiltinHttp(); void ioGetFromHttpWithReuseParallel(); void ioGetFromHttpWithReuseSequential(); + void ioGetFromHttpWithAuth_data(); void ioGetFromHttpWithAuth(); void ioGetFromHttpWithAuthSynchronous(); void ioGetFromHttpWithProxyAuth(); @@ -2216,15 +2217,27 @@ void tst_QNetworkReply::ioGetFromHttpWithReuseSequential() } } +void tst_QNetworkReply::ioGetFromHttpWithAuth_data() +{ + QTest::addColumn<QUrl>("url"); + QTest::addColumn<QByteArray>("expectedData"); + + QFile reference(SRCDIR "/rfc3252.txt"); + reference.open(QIODevice::ReadOnly); + QByteArray referenceData = reference.readAll(); + QTest::newRow("basic") << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfcs-auth/rfc3252.txt") << referenceData; + QTest::newRow("digest") << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/auth-digest/") << QByteArray("digest authentication successful\n"); +} + void tst_QNetworkReply::ioGetFromHttpWithAuth() { // This test sends three requests // The first two in parallel // The third after the first two finished - QFile reference(SRCDIR "/rfc3252.txt"); - QVERIFY(reference.open(QIODevice::ReadOnly)); - QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfcs-auth/rfc3252.txt")); + QFETCH(QUrl, url); + QFETCH(QByteArray, expectedData); + QNetworkRequest request(url); { QNetworkReplyPtr reply1 = manager.get(request); QNetworkReplyPtr reply2 = manager.get(request); @@ -2249,14 +2262,12 @@ void tst_QNetworkReply::ioGetFromHttpWithAuth() QCOMPARE(reply1->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); QCOMPARE(reply2->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); - QByteArray referenceData = reference.readAll(); - QCOMPARE(reader1.data, referenceData); - QCOMPARE(reader2.data, referenceData); + QCOMPARE(reader1.data, expectedData); + QCOMPARE(reader2.data, expectedData); QCOMPARE(authspy.count(), 1); } - reference.seek(0); // rinse and repeat: { QNetworkReplyPtr reply = manager.get(request); @@ -2272,13 +2283,12 @@ void tst_QNetworkReply::ioGetFromHttpWithAuth() this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); - QCOMPARE(reader.data, reference.readAll()); + QCOMPARE(reader.data, expectedData); QCOMPARE(authspy.count(), 0); } // now check with synchronous calls: - reference.seek(0); { request.setAttribute( static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute), @@ -2294,7 +2304,7 @@ void tst_QNetworkReply::ioGetFromHttpWithAuth() // the only thing we check here is that the auth cache was used when using synchronous requests QCOMPARE(replySync->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); - QCOMPARE(replySync->readAll(), reference.readAll()); + QCOMPARE(replySync->readAll(), expectedData); } } @@ -3848,6 +3858,8 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp() const int maxRate = rate * 1024 * (100+allowedDeviation) / 100; qDebug() << minRate << "<="<< server.transferRate << "<=" << maxRate << "?"; QVERIFY(server.transferRate >= minRate); + QEXPECT_FAIL("http+limited", "Limiting is broken right now", Continue); + QEXPECT_FAIL("https+limited", "Limiting is broken right now", Continue); QVERIFY(server.transferRate <= maxRate); } } |