diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-01-25 10:43:45 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2011-01-25 10:55:36 (GMT) |
commit | 5f41f2b4bbe3f4d3f7e2ccb6c14273c5a308b837 (patch) | |
tree | 1ea592561d6d2ad203d14b6e1493542db959d323 /tests/auto/qnetworkreply | |
parent | 640152ac8057f026451da814419511cf04446eca (diff) | |
download | Qt-5f41f2b4bbe3f4d3f7e2ccb6c14273c5a308b837.zip Qt-5f41f2b4bbe3f4d3f7e2ccb6c14273c5a308b837.tar.gz Qt-5f41f2b4bbe3f4d3f7e2ccb6c14273c5a308b837.tar.bz2 |
qnetworkreply test stability on symbian
The first few tests could randomly timeout due to delays in starting
the WLAN connection.
This is addressed by opening the default bearer in initTestCase, and
closing it in cleanupTestCase. This will keep the connection active for
the duration of the test, instead of activating/deactivating continuously.
The first SSL test could randomly timeout due to the delay in fetching the
CA certificates from the system (which can be very slow on some phones /
SIM cards).
This is addressed by preloading them in initTestCase - all the tests will
then get system SSL certs from the cache.
Reviewed-by: Markus Goetz
Diffstat (limited to 'tests/auto/qnetworkreply')
-rw-r--r-- | tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 390d5bf..3e07176 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -65,6 +65,11 @@ #include <QtNetwork/qsslerror.h> #include <QtNetwork/qsslconfiguration.h> #endif +#ifndef QT_NO_BEARERMANAGEMENT +#include <QtNetwork/qnetworkconfigmanager.h> +#include <QtNetwork/qnetworkconfiguration.h> +#include <QtNetwork/qnetworksession.h> +#endif #include <time.h> @@ -136,6 +141,11 @@ class tst_QNetworkReply: public QObject QSslConfiguration storedSslConfiguration; QList<QSslError> storedExpectedSslErrors; #endif +#ifndef QT_NO_BEARER_MANAGEMENT + QNetworkConfigurationManager *netConfMan; + QNetworkConfiguration networkConfiguration; + QScopedPointer<QNetworkSession> networkSession; +#endif public: tst_QNetworkReply(); @@ -1140,6 +1150,18 @@ void tst_QNetworkReply::initTestCase() #endif QDir::setSearchPaths("srcdir", QStringList() << SRCDIR); +#ifndef QT_NO_OPENSSL + QSslSocket::defaultCaCertificates(); //preload certificates +#endif +#ifndef QT_NO_BEARERMANAGEMENT + netConfMan = new QNetworkConfigurationManager(this); + networkConfiguration = netConfMan->defaultConfiguration(); + networkSession.reset(new QNetworkSession(networkConfiguration)); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } +#endif } void tst_QNetworkReply::cleanupTestCase() @@ -1147,6 +1169,9 @@ void tst_QNetworkReply::cleanupTestCase() #if !defined Q_OS_WIN QFile::remove(wronlyFileName); #endif + if (networkSession && networkSession->isOpen()) { + networkSession->close(); + } } void tst_QNetworkReply::init() |