summaryrefslogtreecommitdiffstats
path: root/tests/auto/qftp
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-05-25 13:46:01 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-05-25 14:36:30 (GMT)
commita7cf6e27c9e31833991d61685d4dc5b8b5f777b7 (patch)
tree5a8d3f41a27d8eaf1cb1f7176f75f10b06f5666f /tests/auto/qftp
parente0bc5834ce26f91e60d8ca839f8a80ffd6f11c90 (diff)
downloadQt-a7cf6e27c9e31833991d61685d4dc5b8b5f777b7.zip
Qt-a7cf6e27c9e31833991d61685d4dc5b8b5f777b7.tar.gz
Qt-a7cf6e27c9e31833991d61685d4dc5b8b5f777b7.tar.bz2
Update bearer startup code in network autotests
The bearer startup code I added to some of the network autotests to ensure the network was up before testing caused test failures on some linux configurations due to there being no default network defined. I've changed it to follow these steps: 1. update the configuration list & wait for update completed signal - due to the polling engines not having any config defined on the first run before the initial poll happens 2. check default configuration is valid before attempting to start it 3a. for valid configuration, start it and wait for started as before 3b. for invalid configuration, fail if bearer is mandatory, otherwise ignore - on symbian bearer use is "mandatory", on desktop platforms it is optional Reviewed-by: Markus Goetz
Diffstat (limited to 'tests/auto/qftp')
-rw-r--r--tests/auto/qftp/tst_qftp.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp
index 1fa0787..7e431cf 100644
--- a/tests/auto/qftp/tst_qftp.cpp
+++ b/tests/auto/qftp/tst_qftp.cpp
@@ -155,6 +155,7 @@ private:
QFtp *ftp;
#ifndef QT_NO_BEARERMANAGEMENT
+ QNetworkConfigurationManager *netConfMan;
QSharedPointer<QNetworkSession> networkSessionExplicit;
QSharedPointer<QNetworkSession> networkSessionImplicit;
#endif
@@ -225,10 +226,20 @@ void tst_QFtp::initTestCase_data()
void tst_QFtp::initTestCase()
{
#ifndef QT_NO_BEARERMANAGEMENT
- QNetworkConfigurationManager manager;
- networkSessionImplicit = QSharedPointer<QNetworkSession>(new QNetworkSession(manager.defaultConfiguration()));
- networkSessionImplicit->open();
- QVERIFY(networkSessionImplicit->waitForOpened(60000)); //there may be user prompt on 1st connect
+ netConfMan = new QNetworkConfigurationManager(this);
+ netConfMan->updateConfigurations();
+ connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
+ QNetworkConfiguration networkConfiguration = netConfMan->defaultConfiguration();
+ if (networkConfiguration.isValid()) {
+ networkSessionImplicit = QSharedPointer<QNetworkSession>(new QNetworkSession(networkConfiguration));
+ if (!networkSessionImplicit->isOpen()) {
+ networkSessionImplicit->open();
+ QVERIFY(networkSessionImplicit->waitForOpened(30000));
+ }
+ } else {
+ QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired));
+ }
#endif
}
@@ -254,6 +265,8 @@ void tst_QFtp::init()
}
#ifndef QT_NO_BEARERMANAGEMENT
if (setSession) {
+ if (!networkSessionImplicit)
+ QSKIP("test requires a valid default network configuration", SkipSingle);
networkSessionExplicit = networkSessionImplicit;
if (!networkSessionExplicit->isOpen()) {
networkSessionExplicit->open();