Fixed build break when bearer is disabled.
Change-Id: I29e88b046f6502c84acc9c6f566ecc328cf24e38 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
This commit is contained in:
parent
23a372ab8d
commit
5b1aa4c75d
@ -1497,10 +1497,12 @@ void QNetworkReplyHttpImplPrivate::setResumeOffset(quint64 offset)
|
||||
*/
|
||||
bool QNetworkReplyHttpImplPrivate::start()
|
||||
{
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
if (!managerPrivate->networkSession) {
|
||||
postRequest();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// This is not ideal.
|
||||
const QString host = url.host();
|
||||
@ -1511,11 +1513,13 @@ bool QNetworkReplyHttpImplPrivate::start()
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
if (managerPrivate->networkSession->isOpen() &&
|
||||
managerPrivate->networkSession->state() == QNetworkSession::Connected) {
|
||||
postRequest();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -248,10 +248,12 @@ QHostInfo QHostInfoPrivate::fromName(const QString &name, QSharedPointer<QNetwor
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
QHostInfo QHostInfoAgent::fromName(const QString &hostName, QSharedPointer<QNetworkSession>)
|
||||
{
|
||||
return QHostInfoAgent::fromName(hostName);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -95,7 +95,9 @@ class QHostInfoAgent : public QObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
static QHostInfo fromName(const QString &hostName);
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
static QHostInfo fromName(const QString &hostName, QSharedPointer<QNetworkSession> networkSession);
|
||||
#endif
|
||||
};
|
||||
|
||||
class QHostInfoPrivate
|
||||
|
@ -42,11 +42,15 @@
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#include <QtNetwork/QNetworkAccessManager>
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
#include <QtNetwork/QNetworkConfigurationManager>
|
||||
#endif
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
Q_DECLARE_METATYPE(QNetworkAccessManager::NetworkAccessibility);
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
Q_DECLARE_METATYPE(QNetworkAccessManager::NetworkAccessibility)
|
||||
#endif
|
||||
|
||||
class tst_QNetworkAccessManager : public QObject
|
||||
{
|
||||
@ -65,6 +69,7 @@ tst_QNetworkAccessManager::tst_QNetworkAccessManager()
|
||||
|
||||
void tst_QNetworkAccessManager::networkAccessible()
|
||||
{
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
QNetworkAccessManager manager;
|
||||
|
||||
qRegisterMetaType<QNetworkAccessManager::NetworkAccessibility>("QNetworkAccessManager::NetworkAccessibility");
|
||||
@ -105,6 +110,7 @@ void tst_QNetworkAccessManager::networkAccessible()
|
||||
QNetworkAccessManager::NotAccessible);
|
||||
QCOMPARE(manager.networkAccessible(), QNetworkAccessManager::NotAccessible);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QNetworkAccessManager)
|
||||
|
@ -1315,9 +1315,11 @@ void tst_QNetworkReply::cleanupTestCase()
|
||||
#if !defined Q_OS_WIN
|
||||
QFile::remove(wronlyFileName);
|
||||
#endif
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
if (networkSession && networkSession->isOpen()) {
|
||||
networkSession->close();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QNetworkReply::init()
|
||||
|
@ -42,8 +42,10 @@
|
||||
#include <QtTest/QtTest>
|
||||
#include "../qbearertestcommon.h"
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
#include <QtNetwork/qnetworkconfiguration.h>
|
||||
#include <QtNetwork/qnetworkconfigmanager.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
Although this unit test doesn't use QNetworkAccessManager
|
||||
@ -53,17 +55,21 @@
|
||||
#include <QNetworkAccessManager>
|
||||
|
||||
QT_USE_NAMESPACE
|
||||
|
||||
class tst_QNetworkConfiguration : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
void invalidPoint();
|
||||
void comparison();
|
||||
void children();
|
||||
void isRoamingAvailable();
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
void tst_QNetworkConfiguration::invalidPoint()
|
||||
{
|
||||
QNetworkConfiguration pt;
|
||||
@ -188,6 +194,7 @@ void tst_QNetworkConfiguration::isRoamingAvailable()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QTEST_MAIN(tst_QNetworkConfiguration)
|
||||
#include "tst_qnetworkconfiguration.moc"
|
||||
|
@ -42,8 +42,10 @@
|
||||
#include <QtTest/QtTest>
|
||||
#include "../qbearertestcommon.h"
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
#include <QtNetwork/qnetworkconfiguration.h>
|
||||
#include <QtNetwork/qnetworkconfigmanager.h>
|
||||
#endif
|
||||
|
||||
QT_USE_NAMESPACE
|
||||
class tst_QNetworkConfigurationManager : public QObject
|
||||
@ -51,12 +53,15 @@ class tst_QNetworkConfigurationManager : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
void usedInThread(); // this test must be first, or it will falsely pass
|
||||
void allConfigurations();
|
||||
void defaultConfiguration();
|
||||
void configurationFromIdentifier();
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
void printConfigurationDetails(const QNetworkConfiguration& p)
|
||||
{
|
||||
qDebug() << p.name() <<": isvalid->" <<p.isValid() << " type->"<< p.type() <<
|
||||
@ -245,6 +250,7 @@ void tst_QNetworkConfigurationManager::usedInThread()
|
||||
//QCOMPARE(thread.preScanConfigs, preScanConfigs);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
QTEST_MAIN(tst_QNetworkConfigurationManager)
|
||||
#include "tst_qnetworkconfigurationmanager.moc"
|
||||
|
@ -43,9 +43,11 @@
|
||||
#include <QStringList>
|
||||
#include <QLocalSocket>
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
#include <QtNetwork/qnetworkconfiguration.h>
|
||||
#include <QtNetwork/qnetworkconfigmanager.h>
|
||||
#include <QtNetwork/qnetworksession.h>
|
||||
#endif
|
||||
|
||||
#include <QEventLoop>
|
||||
#include <QTimer>
|
||||
@ -62,6 +64,7 @@ int main(int argc, char** argv)
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
// Update configurations so that everything is up to date for this process too.
|
||||
// Event loop is used to wait for awhile.
|
||||
QNetworkConfigurationManager manager;
|
||||
@ -150,6 +153,7 @@ int main(int argc, char** argv)
|
||||
|
||||
oopSocket.disconnectFromServer();
|
||||
oopSocket.waitForDisconnected(-1);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -45,27 +45,31 @@
|
||||
#include <QTimer>
|
||||
#include "../../qbearertestcommon.h"
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
#include <QtNetwork/qnetworkconfigmanager.h>
|
||||
#include <QtNetwork/qnetworksession.h>
|
||||
#endif
|
||||
|
||||
QT_USE_NAMESPACE
|
||||
|
||||
// Can be used to configure tests that require manual attention (such as roaming)
|
||||
//#define QNETWORKSESSION_MANUAL_TESTS 1
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
Q_DECLARE_METATYPE(QNetworkConfiguration)
|
||||
Q_DECLARE_METATYPE(QNetworkConfiguration::Type)
|
||||
#endif
|
||||
|
||||
class tst_QNetworkSession : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
public slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
|
||||
private slots:
|
||||
|
||||
void robustnessBombing();
|
||||
|
||||
void sessionClosing_data();
|
||||
@ -92,8 +96,10 @@ private slots:
|
||||
private:
|
||||
QNetworkConfigurationManager manager;
|
||||
int inProcessSessionManagementCount;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
// Helper functions
|
||||
bool openSession(QNetworkSession *session);
|
||||
bool closeSession(QNetworkSession *session, bool lastSessionOnConfiguration = true);
|
||||
@ -1250,7 +1256,7 @@ void tst_QNetworkSession::sessionAutoClose()
|
||||
|
||||
QCOMPARE(autoCloseSession.toInt(), -1);
|
||||
}
|
||||
#endif
|
||||
|
||||
QTEST_MAIN(tst_QNetworkSession)
|
||||
|
||||
#include "tst_qnetworksession.moc"
|
||||
|
@ -45,8 +45,10 @@
|
||||
#include <qcoreapplication.h>
|
||||
#include <qnetworkinterface.h>
|
||||
#include <qtcpsocket.h>
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
#include <QNetworkConfigurationManager>
|
||||
#include <QNetworkSession>
|
||||
#endif
|
||||
#include "../../../network-settings.h"
|
||||
|
||||
class tst_QNetworkInterface : public QObject
|
||||
@ -68,7 +70,7 @@ private slots:
|
||||
void copyInvalidInterface();
|
||||
|
||||
private:
|
||||
#ifndef QT_NO_BEARER_MANAGEMENT
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
QNetworkConfigurationManager *netConfMan;
|
||||
QNetworkConfiguration networkConfiguration;
|
||||
QScopedPointer<QNetworkSession> networkSession;
|
||||
|
@ -63,7 +63,9 @@
|
||||
|
||||
Q_DECLARE_METATYPE(QHostAddress)
|
||||
Q_DECLARE_METATYPE(QNetworkInterface)
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
Q_DECLARE_METATYPE(QSharedPointer<QNetworkSession>)
|
||||
#endif
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QUdpSocket)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user