diff options
author | Aleksandar Sasha Babic <aleksandar.babic@nokia.com> | 2009-08-13 10:43:41 (GMT) |
---|---|---|
committer | Aleksandar Sasha Babic <aleksandar.babic@nokia.com> | 2009-08-13 10:47:09 (GMT) |
commit | 065b4d31ac7882ab3f5c5c00fe55f30d9f61fa74 (patch) | |
tree | 37b0955a9690eee50b2c5e19d118ed910d13b784 /tests/auto | |
parent | f10b5bce818d69a383b6f8026032a4d749d74083 (diff) | |
download | Qt-065b4d31ac7882ab3f5c5c00fe55f30d9f61fa74.zip Qt-065b4d31ac7882ab3f5c5c00fe55f30d9f61fa74.tar.gz Qt-065b4d31ac7882ab3f5c5c00fe55f30d9f61fa74.tar.bz2 |
Removing some cases that were left in s60
branch after merginig with mainlin/master.
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qlocalsocket/tst_qlocalsocket.cpp | 119 |
1 files changed, 6 insertions, 113 deletions
diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index c8abf2f..3c42ecb 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -87,8 +87,6 @@ private slots: void sendData_data(); void sendData(); - void readBufferOverflow(); - void fullPath(); void hitMaximumConnections_data(); @@ -104,15 +102,11 @@ private slots: void longPath(); void waitForDisconnect(); - void waitForDisconnectByServer(); void removeServer(); void recycleServer(); - void multiConnect(); - void writeOnlySocket(); - void debug(); #ifdef Q_OS_SYMBIAN @@ -153,13 +147,7 @@ public: LocalServer() : QLocalServer() { connect(this, SIGNAL(newConnection()), this, SLOT(slotNewConnection())); - } - - bool listen(const QString &name) - { - removeServer(name); - return QLocalServer::listen(name); - } + }; QList<int> hits; @@ -561,44 +549,10 @@ void tst_QLocalSocket::sendData() QCOMPARE(spy.count(), (canListen ? 1 : 0)); } -void tst_QLocalSocket::readBufferOverflow() -{ - const int readBufferSize = 128; - const int dataBufferSize = readBufferSize * 2; - const QString serverName = QLatin1String("myPreciousTestServer"); - LocalServer server; - server.listen(serverName); - QVERIFY(server.isListening()); - - LocalSocket client; - client.setReadBufferSize(readBufferSize); - client.connectToServer(serverName); - - bool timedOut = true; - QVERIFY(server.waitForNewConnection(3000, &timedOut)); - QVERIFY(!timedOut); - - QCOMPARE(client.state(), QLocalSocket::ConnectedState); - QVERIFY(server.hasPendingConnections()); - - QLocalSocket* serverSocket = server.nextPendingConnection(); - char buffer[dataBufferSize]; - memset(buffer, 0, dataBufferSize); - serverSocket->write(buffer, dataBufferSize); - serverSocket->flush(); - - QVERIFY(client.waitForReadyRead()); - QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize)); -#ifdef QT_LOCALSOCKET_TCP - QTest::qWait(250); -#endif - QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize)); -} - // QLocalSocket/Server can take a name or path, check that it works as expected void tst_QLocalSocket::fullPath() { - LocalServer server; + QLocalServer server; QString name = "qlocalsocket_pathtest"; #if defined(Q_OS_SYMBIAN) QString path = ""; @@ -694,7 +648,7 @@ public: || socket.error() == QLocalSocket::ConnectionRefusedError) && tries < 1000); if (tries == 0 && socket.state() != QLocalSocket::ConnectedState) { - QVERIFY(socket.waitForConnected(30000)); + QVERIFY(socket.waitForConnected(3000)); QVERIFY(socket.state() == QLocalSocket::ConnectedState); } @@ -724,7 +678,7 @@ public: int done = clients; while (done > 0) { bool timedOut = true; - QVERIFY(server.waitForNewConnection(30000, &timedOut)); + QVERIFY(server.waitForNewConnection(3000, &timedOut)); QVERIFY(!timedOut); QLocalSocket *serverSocket = server.nextPendingConnection(); QVERIFY(serverSocket); @@ -782,7 +736,7 @@ void tst_QLocalSocket::threadedConnection() server.wait(); while (!clients.isEmpty()) { - QVERIFY(clients.first()->wait(300000)); + QVERIFY(clients.first()->wait(30000)); Client *client =clients.takeFirst(); client->terminate(); delete client; @@ -878,25 +832,6 @@ void tst_QLocalSocket::waitForDisconnect() QVERIFY(timer.elapsed() < 2000); } -void tst_QLocalSocket::waitForDisconnectByServer() -{ - QString name = "tst_localsocket"; - LocalServer server; - QVERIFY(server.listen(name)); - LocalSocket socket; - QSignalSpy spy(&socket, SIGNAL(disconnected())); - QVERIFY(spy.isValid()); - socket.connectToServer(name); - QVERIFY(socket.waitForConnected(3000)); - QVERIFY(server.waitForNewConnection(3000)); - QLocalSocket *serverSocket = server.nextPendingConnection(); - QVERIFY(serverSocket); - serverSocket->close(); - QVERIFY(serverSocket->state() == QLocalSocket::UnconnectedState); - QVERIFY(socket.waitForDisconnected(3000)); - QCOMPARE(spy.count(), 1); -} - void tst_QLocalSocket::removeServer() { // this is a hostile takeover, but recovering from a crash results in the same @@ -918,7 +853,7 @@ void tst_QLocalSocket::recycleServer() unlink("recycletest1"); #endif - LocalServer server; + QLocalServer server; QLocalSocket client; QVERIFY(server.listen("recycletest1")); @@ -938,48 +873,6 @@ void tst_QLocalSocket::recycleServer() QVERIFY(server.nextPendingConnection() != 0); } -void tst_QLocalSocket::multiConnect() -{ - QLocalServer server; - QLocalSocket client1; - QLocalSocket client2; - QLocalSocket client3; - - QVERIFY(server.listen("multiconnect")); - - client1.connectToServer("multiconnect"); - client2.connectToServer("multiconnect"); - client3.connectToServer("multiconnect"); - - QVERIFY(client1.waitForConnected(201)); - QVERIFY(client2.waitForConnected(202)); - QVERIFY(client3.waitForConnected(203)); - - QVERIFY(server.waitForNewConnection(201)); - QVERIFY(server.nextPendingConnection() != 0); - QVERIFY(server.waitForNewConnection(202)); - QVERIFY(server.nextPendingConnection() != 0); - QVERIFY(server.waitForNewConnection(203)); - QVERIFY(server.nextPendingConnection() != 0); -} - -void tst_QLocalSocket::writeOnlySocket() -{ - QLocalServer server; - QVERIFY(server.listen("writeOnlySocket")); - - QLocalSocket client; - client.connectToServer("writeOnlySocket", QIODevice::WriteOnly); - QVERIFY(client.waitForConnected()); - - QVERIFY(server.waitForNewConnection()); - QLocalSocket* serverSocket = server.nextPendingConnection(); - QVERIFY(serverSocket); - - QCOMPARE(client.bytesAvailable(), qint64(0)); - QCOMPARE(client.state(), QLocalSocket::ConnectedState); -} - void tst_QLocalSocket::debug() { // Make sure this compiles |