summaryrefslogtreecommitdiffstats
path: root/tests/auto/networkselftest
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-03-28 15:58:34 +0100
committerShane Kearns <shane.kearns@accenture.com>2011-03-29 10:48:24 +0100
commita970c3334bba3b7e1e27fa8b1b4ad4e4724ce015 (patch)
treed9b1f3ba6287e653e89daf053809459d57b4f40c /tests/auto/networkselftest
parentbcbce977fa7a0d61de5f17e6727eba5a823bc3bb (diff)
Bearer support for autotests
Start default bearer when running network self test Fix typo in qnetworkreply test Reviewed-by: Markus Goetz
Diffstat (limited to 'tests/auto/networkselftest')
-rw-r--r--tests/auto/networkselftest/tst_networkselftest.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp
index 64de64a30c..ed070d7f76 100644
--- a/tests/auto/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/networkselftest/tst_networkselftest.cpp
@@ -44,6 +44,12 @@
#include <time.h>
+#ifndef QT_NO_BEARERMANAGEMENT
+#include <QtNetwork/qnetworkconfigmanager.h>
+#include <QtNetwork/qnetworkconfiguration.h>
+#include <QtNetwork/qnetworksession.h>
+#endif
+
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
// Current path (C:\private\<UID>) contains only ascii chars
@@ -64,6 +70,7 @@ public:
QHostAddress serverIpAddress();
private slots:
+ void initTestCase();
void hostTest();
void dnsResolution_data();
void dnsResolution();
@@ -91,6 +98,12 @@ private slots:
// ssl supported test
void supportsSsl();
+private:
+#ifndef QT_NO_BEARERMANAGEMENT
+ QNetworkConfigurationManager *netConfMan;
+ QNetworkConfiguration networkConfiguration;
+ QScopedPointer<QNetworkSession> networkSession;
+#endif
};
class Chat
@@ -354,6 +367,19 @@ QHostAddress tst_NetworkSelfTest::serverIpAddress()
return cachedIpAddress;
}
+void tst_NetworkSelfTest::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_NetworkSelfTest::hostTest()
{
// this is a localhost self-test