summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2012-02-07 03:50:05 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-02-07 07:17:24 (GMT)
commitc85faef67b6a7e8fcedb4ce800282d41f5b79ec1 (patch)
treeea4544d699333664d3819f1636b49c8c062b0e78 /tests
parentf0e41ca85ad9f4b5d426a36410a20200c25eea38 (diff)
downloadQt-c85faef67b6a7e8fcedb4ce800282d41f5b79ec1.zip
Qt-c85faef67b6a7e8fcedb4ce800282d41f5b79ec1.tar.gz
Qt-c85faef67b6a7e8fcedb4ce800282d41f5b79ec1.tar.bz2
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. Change-Id: Ia31bb86495928633159f3527763aad086635e7e4 Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
index 0fc3a82..f8a3342 100644
--- a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
+++ b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
@@ -289,7 +289,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);
@@ -366,7 +366,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 {
@@ -420,7 +420,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();
@@ -453,7 +453,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));
@@ -461,7 +461,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();
@@ -471,14 +471,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");