summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtcpsocket
diff options
context:
space:
mode:
authorJyri Tahtela <jyri.tahtela@nokia.com>2011-05-18 07:41:09 (GMT)
committerJyri Tahtela <jyri.tahtela@nokia.com>2011-05-18 07:41:09 (GMT)
commit9cacde74f7de702689725882633073e60c0a2baa (patch)
tree330d22dadbd28b14a7d8896823d1c33597e9993e /tests/auto/qtcpsocket
parent006c8e22075112eff6230d8168d716e44a9e29d5 (diff)
parent2c07b5d2cba8d8e499bd0861eefef12d4e00d99a (diff)
downloadQt-9cacde74f7de702689725882633073e60c0a2baa.zip
Qt-9cacde74f7de702689725882633073e60c0a2baa.tar.gz
Qt-9cacde74f7de702689725882633073e60c0a2baa.tar.bz2
Merge remote-tracking branch 'qt/4.8'
Conflicts: doc/src/examples/wheel.qdoc src/gui/util/qflickgesture.cpp src/gui/util/qflickgesture_p.h src/gui/util/qscroller.cpp src/gui/util/qscroller.h src/gui/util/qscroller_p.h src/gui/util/qscrollerproperties.cpp src/gui/util/qscrollerproperties.h tests/auto/qscroller/tst_qscroller.cpp
Diffstat (limited to 'tests/auto/qtcpsocket')
-rw-r--r--tests/auto/qtcpsocket/tst_qtcpsocket.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
index 48bed85..1c33107 100644
--- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
@@ -166,7 +166,9 @@ private slots:
void readLineString();
void readChunks();
void waitForBytesWritten();
+ void waitForBytesWrittenMinusOne();
void waitForReadyRead();
+ void waitForReadyReadMinusOne();
void flush();
void synchronousApi();
void dontCloseOnTimeout();
@@ -1417,10 +1419,10 @@ void tst_QTcpSocket::readChunks()
void tst_QTcpSocket::waitForBytesWritten()
{
QTcpSocket *socket = newSocket();
- socket->connectToHost(QtNetworkSettings::serverName(), 22);
+ socket->connectToHost(QtNetworkSettings::serverName(), 80);
QVERIFY(socket->waitForConnected(10000));
- socket->write(QByteArray(10000, '@'));
+ socket->write("GET / HTTP/1.0\r\n\r\n");
qint64 toWrite = socket->bytesToWrite();
QVERIFY(socket->waitForBytesWritten(5000));
QVERIFY(toWrite > socket->bytesToWrite());
@@ -1429,11 +1431,37 @@ void tst_QTcpSocket::waitForBytesWritten()
}
//----------------------------------------------------------------------------------
+void tst_QTcpSocket::waitForBytesWrittenMinusOne()
+{
+ QTcpSocket *socket = newSocket();
+ socket->connectToHost(QtNetworkSettings::serverName(), 80);
+ QVERIFY(socket->waitForConnected(10000));
+
+ socket->write("GET / HTTP/1.0\r\n\r\n");
+ qint64 toWrite = socket->bytesToWrite();
+ QVERIFY(socket->waitForBytesWritten(-1));
+ QVERIFY(toWrite > socket->bytesToWrite());
+
+ delete socket;
+}
+
+//----------------------------------------------------------------------------------
void tst_QTcpSocket::waitForReadyRead()
{
QTcpSocket *socket = newSocket();
- socket->connectToHost(QtNetworkSettings::serverName(), 22);
- socket->waitForReadyRead(0);
+ socket->connectToHost(QtNetworkSettings::serverName(), 80);
+ socket->write("GET / HTTP/1.0\r\n\r\n");
+ QVERIFY(socket->waitForReadyRead(5000));
+ delete socket;
+}
+
+//----------------------------------------------------------------------------------
+void tst_QTcpSocket::waitForReadyReadMinusOne()
+{
+ QTcpSocket *socket = newSocket();
+ socket->connectToHost(QtNetworkSettings::serverName(), 80);
+ socket->write("GET / HTTP/1.0\r\n\r\n");
+ QVERIFY(socket->waitForReadyRead(-1));
delete socket;
}