QNetworkInterface auto test: do not abort without session

... but only if the QNetworkConfiguration manager requires one.

Change-Id: I1c69c43438f1df9080d207c8598a42201f759c5b
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
This commit is contained in:
Peter Hartmann 2013-03-08 17:49:30 +01:00 committed by The Qt Project
parent d0ad02a766
commit b96e8ff1d2

View File

@ -91,11 +91,14 @@ void tst_QNetworkInterface::initTestCase()
QSKIP("No network test server available");
#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));
if (netConfMan->capabilities()
& QNetworkConfigurationManager::NetworkSessionRequired) {
networkConfiguration = netConfMan->defaultConfiguration();
networkSession.reset(new QNetworkSession(networkConfiguration));
if (!networkSession->isOpen()) {
networkSession->open();
QVERIFY(networkSession->waitForOpened(30000));
}
}
#endif
}