summaryrefslogtreecommitdiffstats
path: root/tests/auto/qhostinfo/tst_qhostinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qhostinfo/tst_qhostinfo.cpp')
-rw-r--r--tests/auto/qhostinfo/tst_qhostinfo.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp
index c528a5c..2fa5e76 100644
--- a/tests/auto/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp
@@ -197,13 +197,19 @@ tst_QHostInfo::~tst_QHostInfo()
void tst_QHostInfo::initTestCase()
{
#ifndef QT_NO_BEARERMANAGEMENT
- //start the default network
netConfMan = new QNetworkConfigurationManager(this);
+ netConfMan->updateConfigurations();
+ connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
networkConfiguration = netConfMan->defaultConfiguration();
- networkSession.reset(new QNetworkSession(networkConfiguration));
- if (!networkSession->isOpen()) {
- networkSession->open();
- QVERIFY(networkSession->waitForOpened(30000));
+ if (networkConfiguration.isValid()) {
+ networkSession.reset(new QNetworkSession(networkConfiguration));
+ if (!networkSession->isOpen()) {
+ networkSession->open();
+ QVERIFY(networkSession->waitForOpened(30000));
+ }
+ } else {
+ QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired));
}
#endif
@@ -213,6 +219,13 @@ void tst_QHostInfo::initTestCase()
#else
ipv6Available = false;
ipv6LookupsAvailable = false;
+
+ QTcpServer server;
+ if (server.listen(QHostAddress("::1"))) {
+ // We have IPv6 support
+ ipv6Available = true;
+ }
+
#if !defined(QT_NO_GETADDRINFO)
// check if the system getaddrinfo can do IPv6 lookups
struct addrinfo hint, *result = 0;
@@ -235,13 +248,6 @@ void tst_QHostInfo::initTestCase()
#endif
#endif
- QTcpServer server;
- if (server.listen(QHostAddress("::1"))) {
- // We have IPv6 support
- ipv6Available = true;
- }
-
-
// run each testcase with and without test enabled
QTest::addColumn<bool>("cache");
QTest::newRow("WithCache") << true;