summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVille Pernu <ville.pernu@nokia.com>2010-12-31 10:48:09 (GMT)
committerVille Pernu <ville.pernu@nokia.com>2010-12-31 10:48:09 (GMT)
commit5d18d393808d7a4be56eb00ab9f1e9cda9e211c9 (patch)
tree4ad98b9df748564b5f8ea7eb15605a07c13471f9 /tests
parentc35fd096b45d92bb07c7f1aa745222f3ae9a029e (diff)
downloadQt-5d18d393808d7a4be56eb00ab9f1e9cda9e211c9.zip
Qt-5d18d393808d7a4be56eb00ab9f1e9cda9e211c9.tar.gz
Qt-5d18d393808d7a4be56eb00ab9f1e9cda9e211c9.tar.bz2
Fix QNetworkReply autotest cases for QT-3494
These fixes add a new QTest columns to cases tst_QNetworkReply:: ioGetFromHttpStatus100_data and tst_QNetworkReply::ioGetFromHttpNoHeaders. Each test row now has an expected error message per input data string. Task-Number: QT-3494 Reviewed-By: Perttu Pohjonen
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index cff0ae9..6cd9d3c 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -2585,17 +2585,19 @@ void tst_QNetworkReply::ioGetFromHttpBrokenServer()
void tst_QNetworkReply::ioGetFromHttpStatus100_data()
{
QTest::addColumn<QByteArray>("dataToSend");
- QTest::newRow("normal") << QByteArray("HTTP/1.1 100 Continue\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n");
- QTest::newRow("minimal") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n");
- QTest::newRow("minimal2") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\r\n\r\n");
- QTest::newRow("minimal3") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\n\n");
- QTest::newRow("with_headers") << QByteArray("HTTP/1.1 100 Continue\r\nBla: x\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n");
- QTest::newRow("with_headers2") << QByteArray("HTTP/1.1 100 Continue\nBla: x\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n");
+ QTest::addColumn<QNetworkReply::NetworkError>("expectedError");
+ QTest::newRow("normal") << QByteArray("HTTP/1.1 100 Continue\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << QNetworkReply::NoError;
+ QTest::newRow("minimal") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << QNetworkReply::NoError;
+ QTest::newRow("minimal2") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\r\n\r\n") << QNetworkReply::RemoteHostClosedError;
+ QTest::newRow("minimal3") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\n\n") << QNetworkReply::RemoteHostClosedError;
+ QTest::newRow("with_headers") << QByteArray("HTTP/1.1 100 Continue\r\nBla: x\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << QNetworkReply::NoError;
+ QTest::newRow("with_headers2") << QByteArray("HTTP/1.1 100 Continue\nBla: x\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << QNetworkReply::NoError;
}
void tst_QNetworkReply::ioGetFromHttpStatus100()
{
QFETCH(QByteArray, dataToSend);
+ QFETCH(QNetworkReply::NetworkError, expectedError);
MiniHttpServer server(dataToSend);
server.doClose = true;
@@ -2607,7 +2609,7 @@ void tst_QNetworkReply::ioGetFromHttpStatus100()
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(reply->url(), request.url());
- QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QCOMPARE(reply->error(), expectedError);
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
QVERIFY(reply->rawHeader("bla").isNull());
}
@@ -2615,12 +2617,14 @@ void tst_QNetworkReply::ioGetFromHttpStatus100()
void tst_QNetworkReply::ioGetFromHttpNoHeaders_data()
{
QTest::addColumn<QByteArray>("dataToSend");
- QTest::newRow("justStatus+noheaders+disconnect") << QByteArray("HTTP/1.0 200 OK\r\n\r\n");
+ QTest::addColumn<QNetworkReply::NetworkError>("expectedError");
+ QTest::newRow("justStatus+noheaders+disconnect") << QByteArray("HTTP/1.0 200 OK\r\n\r\n") << QNetworkReply::RemoteHostClosedError;
}
void tst_QNetworkReply::ioGetFromHttpNoHeaders()
{
QFETCH(QByteArray, dataToSend);
+ QFETCH(QNetworkReply::NetworkError, expectedError);
MiniHttpServer server(dataToSend);
server.doClose = true;
@@ -2632,7 +2636,7 @@ void tst_QNetworkReply::ioGetFromHttpNoHeaders()
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(reply->url(), request.url());
- QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QCOMPARE(reply->error(), expectedError);
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
}