summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkreply
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2009-06-11 13:59:33 (GMT)
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2009-06-12 09:51:15 (GMT)
commit814667587e6ab9dda754647f08fec969ed8434aa (patch)
tree6f9ed3d54728b2dd017e85926af3693231c91358 /tests/auto/qnetworkreply
parentfd0ef21c295c316ccfebc833c011ed7a9fb5b3fc (diff)
downloadQt-814667587e6ab9dda754647f08fec969ed8434aa.zip
Qt-814667587e6ab9dda754647f08fec969ed8434aa.tar.gz
Qt-814667587e6ab9dda754647f08fec969ed8434aa.tar.bz2
Allow a maximum of 6 simultaneous HTTP connections to a server.
Even though the standard mandates a maximum of 2 connections, most new browsers support atleast 6 connections. So we are also bumping the limit. Task-number: 251144 Reviewed-by: Markus Goetz Reviewed-by: Peter Hartmann
Diffstat (limited to 'tests/auto/qnetworkreply')
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 43b4ea9..a93d0b6 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -243,6 +243,8 @@ private Q_SLOTS:
void proxyChange();
void authorizationError_data();
void authorizationError();
+
+ void httpConnectionCount();
};
QT_BEGIN_NAMESPACE
@@ -3665,5 +3667,34 @@ void tst_QNetworkReply::authorizationError()
QCOMPARE(QString(reply->readAll()), httpBody);
}
+void tst_QNetworkReply::httpConnectionCount()
+{
+ QTcpServer server;
+ QVERIFY(server.listen());
+ QCoreApplication::instance()->processEvents();
+
+ for (int i = 0; i < 10; i++) {
+ QNetworkRequest request (QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/" + QString::number(i)));
+ QNetworkReply* reply = manager.get(request);
+ reply->setParent(this);
+ }
+
+ int pendingConnectionCount = 0;
+ QTime time;
+ time.start();
+
+ while(pendingConnectionCount != 6) {
+ QCoreApplication::instance()->processEvents();
+ while (server.nextPendingConnection())
+ pendingConnectionCount++;
+
+ // at max. wait 10 sec
+ if (time.elapsed() > 10000)
+ break;
+ }
+
+ QCOMPARE(pendingConnectionCount, 6);
+}
+
QTEST_MAIN(tst_QNetworkReply)
#include "tst_qnetworkreply.moc"