summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkinterface
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-03-14 16:17:10 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-03-15 09:55:21 (GMT)
commit76a18d2eab6b94929f79dc0c4bec59caaaa8d270 (patch)
tree4cf96e77b68f614cbccd4adbf082b947c0c9dbca /tests/auto/qnetworkinterface
parentcec4faf5b0eb2d5f55c4651c1a8e6137808c21c7 (diff)
downloadQt-76a18d2eab6b94929f79dc0c4bec59caaaa8d270.zip
Qt-76a18d2eab6b94929f79dc0c4bec59caaaa8d270.tar.gz
Qt-76a18d2eab6b94929f79dc0c4bec59caaaa8d270.tar.bz2
Enable IPv6 test in QNetworkInterface autotest
IPv6 test was skipped for symbian, now enabled it. Also start the default bearer before testing, so there are interfaces other than loopback available to test. Reviewed-by: Markus Goetz
Diffstat (limited to 'tests/auto/qnetworkinterface')
-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()