summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2012-02-08 10:59:38 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-08 02:10:44 +0100
commitf50a84008eb24d164df4e375084df457e9c85ce7 (patch)
treeadba09b5fa402b8dff99952921282a3415b6021b /tests
parent269ef14215d3c3f89fe6239879a5db111dc1a7b4 (diff)
Improved stability of tst_qhttpsocketengine
This autotest assumed that various network operations could always be completed within 5 seconds. Notably, it assumed that an attempt to resolve a nonexistent hostname would always result in an error within 5 seconds. In my testing, it usually takes 4-6 seconds to complete, but occasionally takes as much as 13 seconds. (cherry picked from qt4 commit c85faef67b6a7e8fcedb4ce800282d41f5b79ec1) Change-Id: I982ecf6ebc1bb8ee2184cf5592cb2684474c870b Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp
index 9b8391d6be..43b1f225c4 100644
--- a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp
+++ b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp
@@ -294,7 +294,7 @@ void tst_QHttpSocketEngine::errorTest()
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)),
&QTestEventLoop::instance(), SLOT(exitLoop()));
- QTestEventLoop::instance().enterLoop(5);
+ QTestEventLoop::instance().enterLoop(30);
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(int(socket.error()), expectedError);
@@ -371,7 +371,7 @@ void tst_QHttpSocketEngine::simpleErrorsAndStates()
QVERIFY(socketDevice.state() == QAbstractSocket::UnconnectedState);
QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverName()), 8088));
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
- if (socketDevice.waitForWrite(15000)) {
+ if (socketDevice.waitForWrite(30000)) {
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState ||
socketDevice.state() == QAbstractSocket::UnconnectedState);
} else {
@@ -425,7 +425,7 @@ void tst_QHttpSocketEngine::tcpLoopbackPerformance()
QTime timer;
timer.start();
qlonglong readBytes = 0;
- while (timer.elapsed() < 5000) {
+ while (timer.elapsed() < 30000) {
qlonglong written = serverSocket.write(message1.data(), message1.size());
while (written > 0) {
client.waitForRead();
@@ -458,7 +458,7 @@ void tst_QHttpSocketEngine::tcpSocketBlockingTest()
QCOMPARE(socket.state(), QTcpSocket::ConnectedState);
// Read greeting
- QVERIFY(socket.waitForReadyRead(5000));
+ QVERIFY(socket.waitForReadyRead(30000));
QString s = socket.readLine();
QVERIFY2(QtNetworkSettings::compareReplyIMAP(s.toLatin1()), qPrintable(s));
@@ -466,7 +466,7 @@ void tst_QHttpSocketEngine::tcpSocketBlockingTest()
QCOMPARE((int) socket.write("1 NOOP\r\n", 8), 8);
if (!socket.canReadLine())
- QVERIFY(socket.waitForReadyRead(5000));
+ QVERIFY(socket.waitForReadyRead(30000));
// Read response
s = socket.readLine();
@@ -476,14 +476,14 @@ void tst_QHttpSocketEngine::tcpSocketBlockingTest()
QCOMPARE((int) socket.write("2 LOGOUT\r\n", 10), 10);
if (!socket.canReadLine())
- QVERIFY(socket.waitForReadyRead(5000));
+ QVERIFY(socket.waitForReadyRead(30000));
// Read two lines of respose
s = socket.readLine();
QCOMPARE(s.toLatin1().constData(), "* BYE LOGOUT received\r\n");
if (!socket.canReadLine())
- QVERIFY(socket.waitForReadyRead(5000));
+ QVERIFY(socket.waitForReadyRead(30000));
s = socket.readLine();
QCOMPARE(s.toLatin1().constData(), "2 OK Completed\r\n");