diff options
Diffstat (limited to 'tests')
12 files changed, 94 insertions, 68 deletions
diff --git a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro index b539dd3..05d17f1 100644 --- a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro +++ b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro @@ -3,3 +3,7 @@ SOURCES += tst_qnetworkconfigmanager.cpp HEADERS += ../qbearertestcommon.h QT = core network + +symbian { + TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData +} diff --git a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp index f065f78..3052330 100644 --- a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp +++ b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp @@ -44,7 +44,7 @@ #include "qnetworkconfiguration.h" #include "qnetworkconfigmanager.h" -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 #include <stdio.h> #include <iapconf.h> #endif @@ -66,7 +66,7 @@ private slots: void configurationFromIdentifier(); private: -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 Maemo::IAPConf *iapconf; Maemo::IAPConf *iapconf2; Maemo::IAPConf *gprsiap; @@ -78,7 +78,7 @@ private: void tst_QNetworkConfigurationManager::initTestCase() { -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf = new Maemo::IAPConf("007"); iapconf->setValue("ipv4_type", "AUTO"); iapconf->setValue("wlan_wepkey1", "connt"); @@ -152,7 +152,7 @@ void tst_QNetworkConfigurationManager::initTestCase() void tst_QNetworkConfigurationManager::cleanupTestCase() { -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf->clear(); delete iapconf; iapconf2->clear(); diff --git a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro index 078983d..ce11cc7 100644 --- a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro +++ b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro @@ -3,3 +3,7 @@ SOURCES += tst_qnetworkconfiguration.cpp HEADERS += ../qbearertestcommon.h QT = core network + +symbian { + TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData +} diff --git a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp index 9ac9e47..70f4447 100644 --- a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp +++ b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp @@ -44,7 +44,7 @@ #include "qnetworkconfiguration.h" #include "qnetworkconfigmanager.h" -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 #include <stdio.h> #include <iapconf.h> #endif @@ -65,7 +65,7 @@ private slots: void isRoamingAvailable(); private: -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 Maemo::IAPConf *iapconf; Maemo::IAPConf *iapconf2; Maemo::IAPConf *gprsiap; @@ -77,7 +77,7 @@ private: void tst_QNetworkConfiguration::initTestCase() { -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf = new Maemo::IAPConf("007"); iapconf->setValue("ipv4_type", "AUTO"); iapconf->setValue("wlan_wepkey1", "connt"); @@ -150,7 +150,7 @@ void tst_QNetworkConfiguration::initTestCase() void tst_QNetworkConfiguration::cleanupTestCase() { -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf->clear(); delete iapconf; iapconf2->clear(); diff --git a/tests/auto/qnetworksession/lackey/main.cpp b/tests/auto/qnetworksession/lackey/main.cpp index 9f32696..a84021d 100644 --- a/tests/auto/qnetworksession/lackey/main.cpp +++ b/tests/auto/qnetworksession/lackey/main.cpp @@ -107,7 +107,7 @@ int main(int argc, char** argv) session->open(); session->waitForOpened(); - } while (!(session && session->isActive())); + } while (!(session && session->isOpen())); qDebug() << "loop done"; diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp index c7ce963..061108a 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp @@ -46,7 +46,7 @@ #include <qnetworkconfigmanager.h> #include <qnetworksession.h> -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 #include <stdio.h> #include <iapconf.h> #endif @@ -84,7 +84,7 @@ private: uint inProcessSessionManagementCount; -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 Maemo::IAPConf *iapconf; Maemo::IAPConf *iapconf2; Maemo::IAPConf *gprsiap; @@ -100,7 +100,7 @@ void tst_QNetworkSession::initTestCase() qRegisterMetaType<QNetworkSession::SessionError>("QNetworkSession::SessionError"); qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration"); -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf = new Maemo::IAPConf("007"); iapconf->setValue("ipv4_type", "AUTO"); iapconf->setValue("wlan_wepkey1", "connt"); @@ -186,7 +186,7 @@ void tst_QNetworkSession::cleanupTestCase() "tests in inProcessSessionManagement()"); } -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf->clear(); delete iapconf; iapconf2->clear(); @@ -212,7 +212,7 @@ void tst_QNetworkSession::cleanupTestCase() void tst_QNetworkSession::invalidSession() { QNetworkSession session(QNetworkConfiguration(), 0); - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); QVERIFY(session.state() == QNetworkSession::Invalid); } @@ -236,7 +236,7 @@ void tst_QNetworkSession::sessionProperties() QVERIFY(session.configuration() == configuration); - QStringList validBearerNames = QStringList() << QString() + QStringList validBearerNames = QStringList() << QLatin1String("Unknown") << QLatin1String("Ethernet") << QLatin1String("WLAN") << QLatin1String("2G") @@ -246,10 +246,21 @@ void tst_QNetworkSession::sessionProperties() << QLatin1String("Bluetooth") << QLatin1String("WiMAX"); - if (!configuration.isValid()) - QVERIFY(session.bearerName().isEmpty()); - else - QVERIFY(validBearerNames.contains(session.bearerName())); + if (!configuration.isValid()) { + QVERIFY(configuration.bearerName().isEmpty()); + } else { + switch (configuration.type()) + { + case QNetworkConfiguration::ServiceNetwork: + case QNetworkConfiguration::UserChoice: + default: + QVERIFY(configuration.bearerName().isEmpty()); + break; + case QNetworkConfiguration::InternetAccessPoint: + QVERIFY(validBearerNames.contains(configuration.bearerName())); + break; + } + } // QNetworkSession::interface() should return an invalid interface unless // session is in the connected state. @@ -302,9 +313,9 @@ void tst_QNetworkSession::userChoiceSession() QVERIFY(session.configuration() == configuration); - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); - QVERIFY(session.sessionProperty("ActiveConfigurationIdentifier").toString().isEmpty()); + QVERIFY(session.sessionProperty("ActiveConfiguration").toString().isEmpty()); // The remaining tests require the session to be not NotAvailable. @@ -324,7 +335,7 @@ void tst_QNetworkSession::userChoiceSession() session.waitForOpened(); - if (session.isActive()) + if (session.isOpen()) QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); if (!errorSpy.isEmpty()) { QNetworkSession::SessionError error = @@ -359,7 +370,7 @@ void tst_QNetworkSession::userChoiceSession() QVERIFY(session.interface().isValid()); const QString userChoiceIdentifier = - session.sessionProperty("UserChoiceConfigurationIdentifier").toString(); + session.sessionProperty("UserChoiceConfiguration").toString(); QVERIFY(!userChoiceIdentifier.isEmpty()); QVERIFY(userChoiceIdentifier != configuration.identifier()); @@ -371,12 +382,12 @@ void tst_QNetworkSession::userChoiceSession() QVERIFY(userChoiceConfiguration.type() != QNetworkConfiguration::UserChoice); const QString testIdentifier("abc"); - //resetting UserChoiceConfigurationIdentifier is ignored (read only property) - session.setSessionProperty("UserChoiceConfigurationIdentifier", testIdentifier); - QVERIFY(session.sessionProperty("UserChoiceConfigurationIdentifier").toString() != testIdentifier); + //resetting UserChoiceConfiguration is ignored (read only property) + session.setSessionProperty("UserChoiceConfiguration", testIdentifier); + QVERIFY(session.sessionProperty("UserChoiceConfiguration").toString() != testIdentifier); const QString activeIdentifier = - session.sessionProperty("ActiveConfigurationIdentifier").toString(); + session.sessionProperty("ActiveConfiguration").toString(); QVERIFY(!activeIdentifier.isEmpty()); QVERIFY(activeIdentifier != configuration.identifier()); @@ -387,9 +398,9 @@ void tst_QNetworkSession::userChoiceSession() QVERIFY(activeConfiguration.isValid()); QVERIFY(activeConfiguration.type() == QNetworkConfiguration::InternetAccessPoint); - //resetting ActiveConfigurationIdentifier is ignored (read only property) - session.setSessionProperty("ActiveConfigurationIdentifier", testIdentifier); - QVERIFY(session.sessionProperty("ActiveConfigurationIdentifier").toString() != testIdentifier); + //resetting ActiveConfiguration is ignored (read only property) + session.setSessionProperty("ActiveConfiguration", testIdentifier); + QVERIFY(session.sessionProperty("ActiveConfiguration").toString() != testIdentifier); if (userChoiceConfiguration.type() == QNetworkConfiguration::InternetAccessPoint) { QVERIFY(userChoiceConfiguration == activeConfiguration); @@ -429,7 +440,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() // Test initial state of the session. { QVERIFY(session.configuration() == configuration); - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); // session may be invalid if configuration is removed between when // sessionOpenCloseStop_data() is called and here. QVERIFY((configuration.isValid() && (session.state() != QNetworkSession::Invalid)) || @@ -455,7 +466,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() session.waitForOpened(); - if (session.isActive()) + if (session.isOpen()) QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); if (!errorSpy.isEmpty()) { QNetworkSession::SessionError error = @@ -519,7 +530,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() // Test opening a second session. { QVERIFY(session2.configuration() == configuration); - QVERIFY(!session2.isActive()); + QVERIFY(!session2.isOpen()); QVERIFY(session2.state() == QNetworkSession::Connected); QVERIFY(session.error() == QNetworkSession::UnknownSessionError); @@ -527,8 +538,8 @@ void tst_QNetworkSession::sessionOpenCloseStop() QTRY_VERIFY(!sessionOpenedSpy2.isEmpty() || !errorSpy2.isEmpty()); - QVERIFY(session.isActive()); - QVERIFY(session2.isActive()); + QVERIFY(session.isOpen()); + QVERIFY(session2.isOpen()); QVERIFY(session.state() == QNetworkSession::Connected); QVERIFY(session2.state() == QNetworkSession::Connected); QVERIFY(session.interface().isValid()); @@ -552,7 +563,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() QTRY_VERIFY(!sessionClosedSpy2.isEmpty() || !errorSpy2.isEmpty()); - QVERIFY(!session2.isActive()); + QVERIFY(!session2.isOpen()); if (!errorSpy2.isEmpty()) { QVERIFY(!errorSpy.isEmpty()); @@ -634,7 +645,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() } } if (roamedSuccessfully) { - QString configId = session.sessionProperty("ActiveConfigurationIdentifier").toString(); + QString configId = session.sessionProperty("ActiveConfiguration").toString(); QNetworkConfiguration config = manager.configurationFromIdentifier(configId); QNetworkSession session3(config); QSignalSpy errorSpy3(&session3, SIGNAL(error(QNetworkSession::SessionError))); @@ -643,7 +654,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() session3.open(); session3.waitForOpened(); - if (session.isActive()) + if (session.isOpen()) QVERIFY(!sessionOpenedSpy3.isEmpty() || !errorSpy3.isEmpty()); session.stop(); @@ -684,9 +695,9 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(!sessionClosedSpy2.isEmpty()); #ifndef Q_CC_NOKIAX86 - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); #endif - QVERIFY(!session2.isActive()); + QVERIFY(!session2.isOpen()); } else { // Test closing the second session. { @@ -700,8 +711,8 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(sessionClosedSpy.isEmpty()); - QVERIFY(session.isActive()); - QVERIFY(!session2.isActive()); + QVERIFY(session.isOpen()); + QVERIFY(!session2.isOpen()); QVERIFY(session.state() == QNetworkSession::Connected); QVERIFY(session2.state() == QNetworkSession::Connected); QVERIFY(session.interface().isValid()); @@ -726,7 +737,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() QTRY_VERIFY(!sessionClosedSpy.isEmpty() || !errorSpy.isEmpty()); - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); if (expectStateChange) QTRY_VERIFY(!stateChangedSpy.isEmpty() || !errorSpy.isEmpty()); @@ -783,12 +794,15 @@ void tst_QNetworkSession::outOfProcessSession() QList<QNetworkConfiguration> before = manager.allConfigurations(QNetworkConfiguration::Active); - QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration))); - + QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration))); + // Cannot read/write to processes on WinCE or Symbian. // Easiest alternative is to use sockets for IPC. QLocalServer oopServer; + // First remove possible earlier listening address which would cause listen to fail + // (e.g. previously abruptly ended unit test might cause this) + QLocalServer::removeServer("tst_qnetworksession"); oopServer.listen("tst_qnetworksession"); QProcess lackey; diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro index bf33122..85aa5aa 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro @@ -3,3 +3,7 @@ SOURCES += tst_qnetworksession.cpp HEADERS += ../../qbearertestcommon.h QT = core network + +symbian { + TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData +}
\ No newline at end of file diff --git a/tests/manual/bearerex/bearerex.cpp b/tests/manual/bearerex/bearerex.cpp index c5bf786..19246a2 100644 --- a/tests/manual/bearerex/bearerex.cpp +++ b/tests/manual/bearerex/bearerex.cpp @@ -70,10 +70,6 @@ void BearerEx::createMenus() menuBar()->addAction(act1); connect(act1, SIGNAL(triggered()), this, SLOT(on_showDetailsButton_clicked())); - m_openAction = new QAction(tr("Open Session"), this); - menuBar()->addAction(m_openAction); - connect(m_openAction, SIGNAL(triggered()), this, SLOT(on_openSessionButton_clicked())); - QAction* exitAct = new QAction(tr("Exit"), this); menuBar()->addAction(exitAct); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); @@ -291,7 +287,7 @@ SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration, } else if (apNetworkConfiguration->type() == QNetworkConfiguration::ServiceNetwork) { snapLineEdit->setText(apNetworkConfiguration->name()+" ("+apNetworkConfiguration->identifier()+")"); } - bearerLineEdit->setText(m_NetworkSession->bearerName()); + bearerLineEdit->setText(apNetworkConfiguration->bearerName()); sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+ QString(" / ")+ QString::number(m_NetworkSession->bytesReceived())); @@ -342,7 +338,7 @@ void SessionTab::on_sendRequestButton_clicked() void SessionTab::on_openSessionButton_clicked() { m_NetworkSession->open(); - if (m_NetworkSession->isActive()) { + if (m_NetworkSession->isOpen()) { newState(m_NetworkSession->state()); } } @@ -350,7 +346,7 @@ void SessionTab::on_openSessionButton_clicked() void SessionTab::on_closeSessionButton_clicked() { m_NetworkSession->close(); - if (!m_NetworkSession->isActive()) { + if (!m_NetworkSession->isOpen()) { newState(m_NetworkSession->state()); } } @@ -419,7 +415,7 @@ void SessionTab::opened() listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Opened")); m_eventListWidget->addItem(listItem); - QVariant identifier = m_NetworkSession->property("ActiveConfigurationIdentifier"); + QVariant identifier = m_NetworkSession->property("ActiveConfiguration"); if (!identifier.isNull()) { QString configId = identifier.toString(); QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); @@ -429,7 +425,7 @@ void SessionTab::opened() } if (m_NetworkSession->configuration().type() == QNetworkConfiguration::UserChoice) { - QVariant identifier = m_NetworkSession->property("UserChoiceConfigurationIdentifier"); + QVariant identifier = m_NetworkSession->property("UserChoiceConfiguration"); if (!identifier.isNull()) { QString configId = identifier.toString(); QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); @@ -491,22 +487,21 @@ void SessionTab::stateChanged(QNetworkSession::State state) void SessionTab::newState(QNetworkSession::State state) { - if (state == QNetworkSession::Connected) { - QVariant identifier = m_NetworkSession->property("ActiveConfigurationIdentifier"); - if (!identifier.isNull()) { - QString configId = identifier.toString(); - QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); - if (config.isValid()) { - iapLineEdit->setText(config.name()+" ("+config.identifier()+")"); - } + QVariant identifier = m_NetworkSession->property("ActiveConfiguration"); + if (state == QNetworkSession::Connected && !identifier.isNull()) { + QString configId = identifier.toString(); + QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); + if (config.isValid()) { + iapLineEdit->setText(config.name()+" ("+config.identifier()+")"); + bearerLineEdit->setText(config.bearerName()); } + } else { + bearerLineEdit->setText(m_NetworkSession->configuration().bearerName()); } - bearerLineEdit->setText(m_NetworkSession->bearerName()); - QString active; - if (m_NetworkSession->isActive()) { - active = " (A)"; + if (m_NetworkSession->isOpen()) { + active = " (O)"; } stateLineEdit->setText(stateString(state)+active); } diff --git a/tests/manual/bearerex/bearerex.h b/tests/manual/bearerex/bearerex.h index ff5f23c..2875d6a 100644 --- a/tests/manual/bearerex/bearerex.h +++ b/tests/manual/bearerex/bearerex.h @@ -52,7 +52,10 @@ #include "qnetworksession.h" #include "xqlistwidget.h" +QT_BEGIN_NAMESPACE class QHttp; +QT_END_NAMESPACE + class SessionTab; QT_USE_NAMESPACE diff --git a/tests/manual/bearerex/bearerex.pro b/tests/manual/bearerex/bearerex.pro index 476e87c..927f982 100644 --- a/tests/manual/bearerex/bearerex.pro +++ b/tests/manual/bearerex/bearerex.pro @@ -16,3 +16,5 @@ HEADERS += bearerex.h \ SOURCES += bearerex.cpp \ main.cpp \ xqlistwidget.cpp + +symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData
\ No newline at end of file diff --git a/tests/manual/networkmanager/nmview.cpp b/tests/manual/networkmanager/nmview.cpp index f7611f0..9e28ff0 100644 --- a/tests/manual/networkmanager/nmview.cpp +++ b/tests/manual/networkmanager/nmview.cpp @@ -188,8 +188,6 @@ void NMView::getActiveConnections() void NMView::update() { -// if(sess) -// qWarning() << __FUNCTION__<< sess->bytesWritten() << sess->bearerName(); // QNetworkManagerInterface *dbIface; // dbIface = new QNetworkManagerInterface; // QList <QDBusObjectPath> connections = dbIface->activeConnections(); diff --git a/tests/manual/networkmanager/nmview.h b/tests/manual/networkmanager/nmview.h index b725ade..41ee04f 100644 --- a/tests/manual/networkmanager/nmview.h +++ b/tests/manual/networkmanager/nmview.h @@ -49,9 +49,11 @@ QT_USE_NAMESPACE +QT_BEGIN_NAMESPACE class QListWidget; class QTreeWidget; class QTreeWidgetItem; +QT_END_NAMESPACE class NMView : public QDialog, private Ui::Dialog { |