summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Niccoli <lultimouomo@gmail.com>2015-03-11 12:26:22 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2015-03-13 13:26:18 +0000
commit15627cc2232bf155d892b630b7e0cb04ce6bbe67 (patch)
treea748c673d89ac5721430c0cbe4124a82efaf4ecd
parentbf0a3b6c6b0dc35420655e6325dc3529da7d40b1 (diff)
downloadqtwebsockets-15627cc2232bf155d892b630b7e0cb04ce6bbe67.tar.gz
Enable websocket tests on Windows
The listening socket must be opened on the loopback interface, otherwise the test client won't be able to connect. Also, name resolution can take a lot of time to fail, so we must wait longer when trying to connect to a non-existing host. Change-Id: I6d6744bc89e6e851cf49db5ae2c19aa652c0a8a4 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
-rw-r--r--tests/auto/qwebsocket/tst_qwebsocket.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/tests/auto/qwebsocket/tst_qwebsocket.cpp b/tests/auto/qwebsocket/tst_qwebsocket.cpp
index 92e969b..900f316 100644
--- a/tests/auto/qwebsocket/tst_qwebsocket.cpp
+++ b/tests/auto/qwebsocket/tst_qwebsocket.cpp
@@ -67,7 +67,7 @@ EchoServer::EchoServer(QObject *parent) :
QWebSocketServer::NonSecureMode, this)),
m_clients()
{
- if (m_pWebSocketServer->listen()) {
+ if (m_pWebSocketServer->listen(QHostAddress(QStringLiteral("127.0.0.1")))) {
connect(m_pWebSocketServer, SIGNAL(newConnection()),
this, SLOT(onNewConnection()));
}
@@ -398,8 +398,6 @@ void tst_QWebSocket::tst_invalidOrigin()
void tst_QWebSocket::tst_sendTextMessage()
{
- //TODO: will resolve in another commit
-#ifndef Q_OS_WIN
EchoServer echoServer;
QWebSocket socket;
@@ -475,13 +473,10 @@ void tst_QWebSocket::tst_sendTextMessage()
socket.close(QWebSocketProtocol::CloseCodeGoingAway, reason);
QCOMPARE(socket.closeCode(), QWebSocketProtocol::CloseCodeGoingAway);
QCOMPARE(socket.closeReason(), reason);
-#endif
}
void tst_QWebSocket::tst_sendBinaryMessage()
{
- //TODO: will resolve in another commit
-#ifndef Q_OS_WIN
EchoServer echoServer;
QWebSocket socket;
@@ -549,7 +544,6 @@ void tst_QWebSocket::tst_sendBinaryMessage()
isLastFrame = arguments.at(1).toBool();
QCOMPARE(frameReceived, QByteArrayLiteral("Hello world!"));
QVERIFY(isLastFrame);
-#endif
}
void tst_QWebSocket::tst_errorString()
@@ -565,7 +559,7 @@ void tst_QWebSocket::tst_errorString()
socket.open(QUrl(QStringLiteral("ws://someserver.on.mars:9999")));
if (errorSpy.count() == 0)
- errorSpy.wait();
+ errorSpy.wait(500);
QCOMPARE(errorSpy.count(), 1);
QList<QVariant> arguments = errorSpy.takeFirst();
QAbstractSocket::SocketError socketError =