From c4e7dc4467eb11fb18867a8a5f5bc830ceb73e28 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 6 May 2009 16:41:38 +0300 Subject: Fix to tst_qsslsocket::disconnectFromHostWhenConnected test case. I don't understand how socket->waitForDisconnected can work on other platforms since socket->write will end to: QMetaObject::invokeMethod(this, "_q_flushWriteBuffer", Qt::QueuedConnection); In order that _q_flushWriteBuffer will be called the eventloop need to run. If we just call waitForDisconnected, which blocks the whole thread how that can happen? Changed the test for Symbian OS to use evenloop since I'm not 100% sure. Probably this can change can be applied for other platforms as well without changing the test case` logic? --- tests/auto/qsslsocket/tst_qsslsocket.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 8dfbedd..0ff6692 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -1505,12 +1505,27 @@ void tst_QSslSocket::disconnectFromHostWhenConnected() QSslSocketPtr socket = newSocket(); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 993); socket->ignoreSslErrors(); +#ifndef Q_OS_SYMBIAN QVERIFY(socket->waitForEncrypted(5000)); +#else + QVERIFY(socket->waitForEncrypted(10000)); +#endif socket->write("XXXX LOGOUT\r\n"); QCOMPARE(socket->state(), QAbstractSocket::ConnectedState); socket->disconnectFromHost(); QCOMPARE(socket->state(), QAbstractSocket::ClosingState); - QVERIFY(socket->waitForDisconnected(5000)); +#ifdef Q_OS_SYMBIAN + // I don't understand how socket->waitForDisconnected can work on other platforms + // since socket->write will end to: + // QMetaObject::invokeMethod(this, "_q_flushWriteBuffer", Qt::QueuedConnection); + // In order that _q_flushWriteBuffer will be called the eventloop need to run + // If we just call waitForDisconnected, which blocks the whole thread how that can happen? + connect(socket, SIGNAL(disconnected()), this, SLOT(exitLoop())); + enterLoop(5); + QVERIFY(!timeout()); +#else + QVERIFY(socket->waitForDisconnected(5000)); +#endif QCOMPARE(socket->bytesToWrite(), qint64(0)); } -- cgit v0.12