summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeter Hartmann <peter.hartmann@nokia.com>2009-10-29 17:55:06 +0100
committerPeter Hartmann <peter.hartmann@nokia.com>2009-11-03 10:47:15 +0100
commitb22f7a8af0a781885a64d0cd1001192c99872aef (patch)
tree6aa576d85c3e7087c61c6c625ecadb2303ca54d4 /tests
parent83b5ae49a1778a815a98dd7094822588e82aef3c (diff)
QLocalSocket test: stabilize test by calling waitFor... function
... to make sure bytes are availabe to read Reviewed-by: Aleksandar Sasha Babic
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qlocalsocket/tst_qlocalsocket.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
index ab7b0ac144..5ead049215 100644
--- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
@@ -587,14 +587,16 @@ void tst_QLocalSocket::readBufferOverflow()
char buffer[dataBufferSize];
memset(buffer, 0, dataBufferSize);
serverSocket->write(buffer, dataBufferSize);
- serverSocket->flush();
+ serverSocket->waitForBytesWritten();
+ // wait until the first 128 bytes are ready to read
QVERIFY(client.waitForReadyRead());
QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize));
-#if defined(QT_LOCALSOCKET_TCP) || defined(Q_OS_SYMBIAN)
- QTest::qWait(250);
-#endif
+ // wait until the second 128 bytes are ready to read
+ QVERIFY(client.waitForReadyRead());
QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize));
+ // no more bytes available
+ QVERIFY(client.bytesAvailable() == 0);
}
// QLocalSocket/Server can take a name or path, check that it works as expected