summaryrefslogtreecommitdiffstats
path: root/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp')
-rw-r--r--tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
index 687ec2e..ce96a2c 100644
--- a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
+++ b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
@@ -139,13 +139,14 @@ public slots:
tst_QHttpSocketEngine::tst_QHttpSocketEngine()
{
+ Q_SET_DEFAULT_IAP
}
tst_QHttpSocketEngine::~tst_QHttpSocketEngine()
{
-
}
+
void tst_QHttpSocketEngine::init()
{
tmpSocket = 0;
@@ -305,11 +306,11 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP()
socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128));
- QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143));
+ QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143));
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
QVERIFY(socketDevice.waitForWrite());
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState);
- QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP());
+ QVERIFY(socketDevice.peerAddress() == QHostAddress(QtNetworkSettings::serverIP()));
QVERIFY(!socketDevice.localAddress().isNull());
QVERIFY(socketDevice.localPort() > 0);
@@ -323,9 +324,9 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP()
array.resize(available);
QVERIFY(socketDevice.read(array.data(), array.size()) == available);
- // Check that the greeting is what we expect it to be
- QCOMPARE(array.constData(),
- "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ // Check that the greeting is what we expect it to be
+ QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData());
+
// Write a logout message
QByteArray array2 = "XXXX LOGOUT\r\n";
@@ -454,7 +455,7 @@ void tst_QHttpSocketEngine::tcpSocketBlockingTest()
// Read greeting
QVERIFY(socket.waitForReadyRead(5000));
QString s = socket.readLine();
- QCOMPARE(s.toLatin1().constData(), "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ QCOMPARE(s.toLatin1().constData(), QtNetworkSettings::expectedReplyIMAP().constData());
// Write NOOP
QCOMPARE((int) socket.write("1 NOOP\r\n", 8), 8);
@@ -527,9 +528,11 @@ void tst_QHttpSocketEngine::tcpSocketNonBlockingTest()
}
// Read greeting
- QVERIFY(!tcpSocketNonBlocking_data.isEmpty());
- QCOMPARE(tcpSocketNonBlocking_data.at(0).toLatin1().constData(),
- "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ QVERIFY(!tcpSocketNonBlocking_data.isEmpty());
+ QCOMPARE(tcpSocketNonBlocking_data.at(0).toLatin1().constData(),
+ QtNetworkSettings::expectedReplyIMAP().constData());
+
+
tcpSocketNonBlocking_data.clear();
tcpSocketNonBlocking_totalWritten = 0;
@@ -648,7 +651,7 @@ void tst_QHttpSocketEngine::downloadBigFile()
QTime stopWatch;
stopWatch.start();
-#if defined(Q_OS_WINCE)
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QTestEventLoop::instance().enterLoop(240);
#else
QTestEventLoop::instance().enterLoop(60);
@@ -692,11 +695,11 @@ void tst_QHttpSocketEngine::passwordAuth()
socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128, "qsockstest", "password"));
- QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143));
+ QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143));
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
QVERIFY(socketDevice.waitForWrite());
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState);
- QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP());
+ QVERIFY(socketDevice.peerAddress() == QHostAddress(QtNetworkSettings::serverIP()));
// Wait for the greeting
QVERIFY(socketDevice.waitForRead());
@@ -707,10 +710,10 @@ void tst_QHttpSocketEngine::passwordAuth()
QByteArray array;
array.resize(available);
QVERIFY(socketDevice.read(array.data(), array.size()) == available);
-
+
// Check that the greeting is what we expect it to be
- QCOMPARE(array.constData(),
- "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n");
+ QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData());
+
// Write a logout message
QByteArray array2 = "XXXX LOGOUT\r\n";