From 28675642f3445e41434b004c2a1a1d96ec0145a2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 12 Apr 2012 12:56:20 +0200 Subject: Build manual tests. Add a toplevel manual.pro and other .pro-files to build them and fix the build. Change-Id: Ibc98a27b39dd1304edfa8a6894d62e77ce7ef387 Reviewed-by: Shane Kearns --- .../tst_network_remote_stresstest.cpp | 38 +++++++++++++++++----- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp') diff --git a/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp b/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp index c2981c6df8..109ecbe2aa 100644 --- a/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp +++ b/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp @@ -235,6 +235,10 @@ void tst_NetworkRemoteStressTest::blockingSequentialRemoteHosts() QElapsedTimer outerTimer; outerTimer.start(); +#ifdef QT_NO_SSL + QVERIFY(!useSslSocket); +#endif // QT_NO_SSL + for (int i = 0; i < urlList.size(); ++i) { const QUrl &url = urlList.at(i); bool isHttps = url.scheme() == "https"; @@ -243,21 +247,24 @@ void tst_NetworkRemoteStressTest::blockingSequentialRemoteHosts() timeout.start(); QSharedPointer socket; - if (useSslSocket || isHttps) { +#ifndef QT_NO_SSL + if (useSslSocket || isHttps) socket = QSharedPointer(new QSslSocket); - } else { +#endif // QT_NO_SSL + if (socket.isNull()) socket = QSharedPointer(new QTcpSocket); - } socket->connectToHost(url.host(), url.port(isHttps ? 443 : 80)); QVERIFY2(socket->waitForConnected(10000), "Timeout connecting to " + url.encodedHost()); +#ifndef QT_NO_SSL if (isHttps) { static_cast(socket.data())->setProtocol(QSsl::TlsV1_0); static_cast(socket.data())->startClientEncryption(); static_cast(socket.data())->ignoreSslErrors(); QVERIFY2(static_cast(socket.data())->waitForEncrypted(10000), "Timeout starting TLS with " + url.encodedHost()); } +#endif // QT_NO_SSL socket->write("GET " + url.toEncoded(QUrl::RemoveScheme | QUrl::RemoveAuthority | QUrl::RemoveFragment) + " HTTP/1.0\r\n" "Connection: close\r\n" @@ -288,6 +295,10 @@ void tst_NetworkRemoteStressTest::sequentialRemoteHosts() QFETCH_GLOBAL(QVector, urlList); QFETCH_GLOBAL(bool, useSslSocket); +#ifdef QT_NO_SSL + QVERIFY(!useSslSocket); +#endif // QT_NO_SSL + qint64 totalBytes = 0; QElapsedTimer outerTimer; outerTimer.start(); @@ -300,15 +311,18 @@ void tst_NetworkRemoteStressTest::sequentialRemoteHosts() timeout.start(); QSharedPointer socket; - if (useSslSocket || isHttps) { +#ifndef QT_NO_SSL + if (useSslSocket || isHttps) socket = QSharedPointer(new QSslSocket); - } else { +#endif // QT_NO_SSL + if (socket.isNull()) socket = QSharedPointer(new QTcpSocket); - } if (isHttps) { +#ifndef QT_NO_SSL static_cast(socket.data())->setProtocol(QSsl::TlsV1_0); static_cast(socket.data())->connectToHostEncrypted(url.host(), url.port(443)); static_cast(socket.data())->ignoreSslErrors(); +#endif // QT_NO_SSL } else { socket->connectToHost(url.host(), url.port(80)); } @@ -356,6 +370,10 @@ void tst_NetworkRemoteStressTest::parallelRemoteHosts() QFETCH(int, parallelAttempts); +#ifdef QT_NO_SSL + QVERIFY(!useSslSocket); +#endif // QT_NO_SSL + qint64 totalBytes = 0; QElapsedTimer outerTimer; outerTimer.start(); @@ -371,15 +389,19 @@ void tst_NetworkRemoteStressTest::parallelRemoteHosts() for (int j = 0; j < parallelAttempts && it != urlList.constEnd(); ++j, ++it) { const QUrl &url = *it; bool isHttps = url.scheme() == "https"; - QTcpSocket *socket; + QTcpSocket *socket = 0; +#ifndef QT_NO_SSL if (useSslSocket || isHttps) socket = new QSslSocket; - else +#endif // QT_NO_SSL + if (!socket) socket = new QTcpSocket; if (isHttps) { +#ifndef QT_NO_SSL static_cast(socket)->setProtocol(QSsl::TlsV1_0); static_cast(socket)->connectToHostEncrypted(url.host(), url.port(443)); static_cast(socket)->ignoreSslErrors(); +#endif // QT_NO_SSL } else { socket->connectToHost(url.host(), url.port(isHttps ? 443 : 80)); } -- cgit v1.2.3