summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp')
-rw-r--r--tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp38
1 files changed, 32 insertions, 6 deletions
diff --git a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp
index 0d7c68e..c630eca 100644
--- a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp
+++ b/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp
@@ -45,6 +45,8 @@
#include <qcoreapplication.h>
#include <qnetworkinterface.h>
#include <qtcpsocket.h>
+#include <QNetworkConfigurationManager>
+#include <QNetworkSession>
#include "../network-settings.h"
//TESTED_FILES=qnetworkinterface.cpp qnetworkinterface.h qnetworkinterface_unix.cpp qnetworkinterface_win.cpp
@@ -58,23 +60,52 @@ public:
virtual ~tst_QNetworkInterface();
private slots:
+ void initTestCase();
+ void cleanupTestCase();
void dump();
void loopbackIPv4();
void loopbackIPv6();
void localAddress();
void interfaceFromXXX();
void copyInvalidInterface();
+
+private:
+#ifndef QT_NO_BEARER_MANAGEMENT
+ QNetworkConfigurationManager *netConfMan;
+ QNetworkConfiguration networkConfiguration;
+ QScopedPointer<QNetworkSession> networkSession;
+#endif
};
tst_QNetworkInterface::tst_QNetworkInterface()
{
- Q_SET_DEFAULT_IAP
}
tst_QNetworkInterface::~tst_QNetworkInterface()
{
}
+void tst_QNetworkInterface::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_QNetworkInterface::cleanupTestCase()
+{
+#ifndef QT_NO_BEARERMANAGEMENT
+ if (networkSession && networkSession->isOpen()) {
+ networkSession->close();
+ }
+#endif
+}
void tst_QNetworkInterface::dump()
{
@@ -127,10 +158,6 @@ void tst_QNetworkInterface::loopbackIPv4()
void tst_QNetworkInterface::loopbackIPv6()
{
-#ifdef Q_OS_SYMBIAN
- QSKIP( "Symbian: IPv6 is not yet supported", SkipAll );
-#else
-
QList<QHostAddress> all = QNetworkInterface::allAddresses();
bool loopbackfound = false;
@@ -144,7 +171,6 @@ void tst_QNetworkInterface::loopbackIPv6()
anyIPv6 = true;
QVERIFY(!anyIPv6 || loopbackfound);
-#endif
}
void tst_QNetworkInterface::localAddress()