diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-03-28 17:37:19 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2011-03-29 09:48:27 (GMT) |
commit | 8c3c9742abb2d59daa0b9f8f18bd52d9f2bbdbbe (patch) | |
tree | 7237099633660a0434689e201f5f8cd159cfdb9c /tests/auto/qabstractnetworkcache | |
parent | 917a1a04d7a507dbab4ae9e9983507870232a821 (diff) | |
download | Qt-8c3c9742abb2d59daa0b9f8f18bd52d9f2bbdbbe.zip Qt-8c3c9742abb2d59daa0b9f8f18bd52d9f2bbdbbe.tar.gz Qt-8c3c9742abb2d59daa0b9f8f18bd52d9f2bbdbbe.tar.bz2 |
Add bearer startup to qabstractnetworkcache autotest
This avoids the test starting and stopping the WLAN for each test case
Reviewed-by: Markus Goetz
Diffstat (limited to 'tests/auto/qabstractnetworkcache')
-rw-r--r-- | tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index db0d0a7..76e6711 100644 --- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -45,6 +45,12 @@ #include "../../shared/util.h" #include "../network-settings.h" +#ifndef QT_NO_BEARERMANAGEMENT +#include <QtNetwork/qnetworkconfigmanager.h> +#include <QtNetwork/qnetworkconfiguration.h> +#include <QtNetwork/qnetworksession.h> +#endif + #define TESTFILE QString("http://%1/qtest/cgi-bin/").arg(QtNetworkSettings::serverName()) class tst_QAbstractNetworkCache : public QObject @@ -56,6 +62,7 @@ public: virtual ~tst_QAbstractNetworkCache(); private slots: + void initTestCase(); void expires_data(); void expires(); void expiresSynchronous_data(); @@ -81,6 +88,12 @@ private slots: private: void check(); void checkSynchronous(); + +#ifndef QT_NO_BEARERMANAGEMENT + QNetworkConfigurationManager *netConfMan; + QNetworkConfiguration networkConfiguration; + QScopedPointer<QNetworkSession> networkSession; +#endif }; class NetworkDiskCache : public QNetworkDiskCache @@ -124,6 +137,19 @@ static bool AlwaysFalse = false; Q_DECLARE_METATYPE(QNetworkRequest::CacheLoadControl) +void tst_QAbstractNetworkCache::initTestCase() +{ +#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_QAbstractNetworkCache::expires_data() { QTest::addColumn<QNetworkRequest::CacheLoadControl>("cacheLoadControl"); |