summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-02-17 13:27:45 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-02-17 13:39:08 (GMT)
commit44ef44bc3826c78a10bcf02d3357bf6332c6c3ed (patch)
tree53053bdacc56009825ab24d3ed313390a9a40d4f
parent42adaaa0dffa9df387a145181bc97ee3bb9a4c7b (diff)
downloadQt-44ef44bc3826c78a10bcf02d3357bf6332c6c3ed.zip
Qt-44ef44bc3826c78a10bcf02d3357bf6332c6c3ed.tar.gz
Qt-44ef44bc3826c78a10bcf02d3357bf6332c6c3ed.tar.bz2
Explicit network session for QNetworkAccessManager
Implemented a tunnel to get the QNetworkSession from QNetworkAccessManager down to the socket engine. This is currently a private API for QNAM. This patch only implements the FTP backend - the other backends are to follow. On Symbian, the native socket engine will extract the native session (RConnection) from the QNetworkSession implementation, and use that to open sockets using the explicitly specified session. When no session is specified on the socket (default for networking usage outside of QNAM) then the socket is opened with no RConnection specified, which allows the IP stack to find any route via an open interface. The QFtp autotest is enhanced to test QFtp with an explicit session as well as implicit connectivity (where a QNetworkSession is opened by the user, and then QFtp is used without a specified connection). This autotest gives better coverage than the FTP test cases in QNetworkReply. Reviewed-by: Markus Goetz
-rw-r--r--src/network/access/qftp.cpp17
-rw-r--r--src/network/access/qnetworkaccessbackend.cpp7
-rw-r--r--src/network/access/qnetworkaccessftpbackend.cpp4
-rw-r--r--src/network/bearer/qnetworksession.cpp9
-rw-r--r--src/network/bearer/qnetworksession_p.h11
-rw-r--r--src/network/socket/qabstractsocket.cpp8
-rw-r--r--src/network/socket/qsymbiansocketengine.cpp31
-rw-r--r--src/network/socket/qsymbiansocketengine_p.h5
-rw-r--r--src/network/socket/qtcpserver.cpp8
-rw-r--r--src/network/ssl/qsslsocket.cpp4
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp5
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.h3
-rw-r--r--tests/auto/qftp/tst_qftp.cpp88
13 files changed, 182 insertions, 18 deletions
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp
index ccc20e6..45fc11f 100644
--- a/src/network/access/qftp.cpp
+++ b/src/network/access/qftp.cpp
@@ -319,6 +319,10 @@ void QFtpDTP::connectToHost(const QString & host, quint16 port)
socket = 0;
}
socket = new QTcpSocket(this);
+#ifndef QT_NO_BEARERMANAGEMENT
+ //copy network session down to the socket
+ socket->setProperty("_q_networksession", property("_q_networksession"));
+#endif
socket->setObjectName(QLatin1String("QFtpDTP Passive state socket"));
connect(socket, SIGNAL(connected()), SLOT(socketConnected()));
connect(socket, SIGNAL(readyRead()), SLOT(socketReadyRead()));
@@ -331,6 +335,10 @@ void QFtpDTP::connectToHost(const QString & host, quint16 port)
int QFtpDTP::setupListener(const QHostAddress &address)
{
+#ifndef QT_NO_BEARERMANAGEMENT
+ //copy network session down to the socket
+ listener.setProperty("_q_networksession", property("_q_networksession"));
+#endif
if (!listener.isListening() && !listener.listen(address, 0))
return -1;
return listener.serverPort();
@@ -808,6 +816,11 @@ QFtpPI::QFtpPI(QObject *parent) :
void QFtpPI::connectToHost(const QString &host, quint16 port)
{
emit connectState(QFtp::HostLookup);
+#ifndef QT_NO_BEARERMANAGEMENT
+ //copy network session down to the socket & DTP
+ commandSocket.setProperty("_q_networksession", property("_q_networksession"));
+ dtp.setProperty("_q_networksession", property("_q_networksession"));
+#endif
commandSocket.connectToHost(host, port);
}
@@ -2240,6 +2253,10 @@ void QFtpPrivate::_q_startNextCommand()
c->rawCmds.clear();
_q_piFinished(QLatin1String("Proxy set to ") + proxyHost + QLatin1Char(':') + QString::number(proxyPort));
} else if (c->command == QFtp::ConnectToHost) {
+#ifndef QT_NO_BEARERMANAGEMENT
+ //copy network session down to the PI
+ pi.setProperty("_q_networksession", q->property("_q_networksession"));
+#endif
if (!proxyHost.isEmpty()) {
host = c->rawCmds[0];
port = c->rawCmds[1].toUInt();
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp
index fd1fa60..de40256 100644
--- a/src/network/access/qnetworkaccessbackend.cpp
+++ b/src/network/access/qnetworkaccessbackend.cpp
@@ -46,7 +46,7 @@
#include "qnetworkreply_p.h"
#include "QtCore/qhash.h"
#include "QtCore/qmutex.h"
-#include "QtNetwork/qnetworksession.h"
+#include "QtNetwork/private/qnetworksession_p.h"
#include "qnetworkaccesscachebackend_p.h"
#include "qabstractnetworkcache.h"
@@ -96,6 +96,11 @@ QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessM
QNetworkAccessBackend *backend = (*it)->create(op, request);
if (backend) {
backend->manager = this;
+#ifndef QT_NO_BEARERMANAGEMENT
+ //copy network session down to the backend
+ if (networkSession)
+ backend->setProperty("_q_networksession", QVariant::fromValue(networkSession));
+#endif
return backend; // found a factory that handled our request
}
++it;
diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp
index e34e6bb..3ad1961 100644
--- a/src/network/access/qnetworkaccessftpbackend.cpp
+++ b/src/network/access/qnetworkaccessftpbackend.cpp
@@ -153,6 +153,10 @@ void QNetworkAccessFtpBackend::open()
if (!objectCache->requestEntry(cacheKey, this,
SLOT(ftpConnectionReady(QNetworkAccessCache::CacheableObject*)))) {
ftp = new QNetworkAccessCachedFtpConnection;
+#ifndef QT_NO_BEARERMANAGEMENT
+ //copy network session down to the QFtp
+ ftp->setProperty("_q_networksession", property("_q_networksession"));
+#endif
#ifndef QT_NO_NETWORKPROXY
if (proxy.type() == QNetworkProxy::FtpCachingProxy)
ftp->setProxy(proxy.hostName(), proxy.port());
diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp
index 553410e..0ddd10a 100644
--- a/src/network/bearer/qnetworksession.cpp
+++ b/src/network/bearer/qnetworksession.cpp
@@ -705,6 +705,15 @@ void QNetworkSession::disconnectNotify(const char *signal)
d->setALREnabled(false);
}
+#ifdef Q_OS_SYMBIAN
+RConnection* QNetworkSessionPrivate::nativeSession(QNetworkSession &s)
+{
+ if (!s.d)
+ return 0;
+ return s.d->nativeSession();
+}
+#endif
+
#include "moc_qnetworksession.cpp"
QT_END_NAMESPACE
diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h
index 707ad37..e2fcfe6 100644
--- a/src/network/bearer/qnetworksession_p.h
+++ b/src/network/bearer/qnetworksession_p.h
@@ -55,9 +55,14 @@
#include "qnetworksession.h"
#include "qnetworkconfiguration_p.h"
+#include "QtCore/qsharedpointer.h"
#ifndef QT_NO_BEARERMANAGEMENT
+#ifdef Q_OS_SYMBIAN
+class RConnection;
+#endif
+
QT_BEGIN_NAMESPACE
class Q_NETWORK_EXPORT QNetworkSessionPrivate : public QObject
@@ -102,6 +107,10 @@ public:
virtual quint64 bytesReceived() const = 0;
virtual quint64 activeTime() const = 0;
+#ifdef Q_OS_SYMBIAN
+ static RConnection* nativeSession(QNetworkSession&);
+ virtual RConnection* nativeSession() = 0;
+#endif
protected:
inline QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const
{
@@ -145,6 +154,8 @@ protected:
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QSharedPointer<QNetworkSession>)
+
#endif // QT_NO_BEARERMANAGEMENT
#endif // QNETWORKSESSIONPRIVATE_H
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 3462538..af5f027 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -546,6 +546,10 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
resetSocketLayer();
socketEngine = QAbstractSocketEngine::createSocketEngine(q->socketType(), proxyInUse, q);
+#ifndef QT_NO_BEARERMANAGEMENT
+ //copy network session down to the socket engine (if it has been set)
+ socketEngine->setProperty("_q_networksession", q->property("_q_networksession"));
+#endif
if (!socketEngine) {
socketError = QAbstractSocket::UnsupportedSocketOperationError;
q->setErrorString(QAbstractSocket::tr("Operation on socket is not supported"));
@@ -1600,6 +1604,10 @@ bool QAbstractSocket::setSocketDescriptor(int socketDescriptor, SocketState sock
d->resetSocketLayer();
d->socketEngine = QAbstractSocketEngine::createSocketEngine(socketDescriptor, this);
+#ifndef QT_NO_BEARERMANAGEMENT
+ //copy network session down to the socket engine (if it has been set)
+ d->socketEngine->setProperty("_q_networksession", property("_q_networksession"));
+#endif
if (!d->socketEngine) {
d->socketError = UnsupportedSocketOperationError;
setErrorString(tr("Operation on socket is not supported"));
diff --git a/src/network/socket/qsymbiansocketengine.cpp b/src/network/socket/qsymbiansocketengine.cpp
index d6b893a..b9537c1 100644
--- a/src/network/socket/qsymbiansocketengine.cpp
+++ b/src/network/socket/qsymbiansocketengine.cpp
@@ -47,6 +47,7 @@
#include "qelapsedtimer.h"
#include "qvarlengtharray.h"
#include "qnetworkinterface.h"
+#include "qnetworksession_p.h"
#include <es_sock.h>
#include <in_sock.h>
#include <net/if.h>
@@ -186,10 +187,26 @@ bool QSymbianSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType so
TUint family = KAfInet; // KAfInet6 is only used as an address family, not as a protocol family
TUint type = (socketType == QAbstractSocket::UdpSocket) ? KSockDatagram : KSockStream;
TUint protocol = (socketType == QAbstractSocket::UdpSocket) ? KProtocolInetUdp : KProtocolInetTcp;
+
+ //Check if there is a user specified session
+ RConnection *connection = 0;
+ QVariant v(q->property("_q_networksession"));
+ if (v.isValid()) {
+ QSharedPointer<QNetworkSession> s = qvariant_cast<QSharedPointer<QNetworkSession> >(v);
+ connection = QNetworkSessionPrivate::nativeSession(*s);
+#ifdef QNATIVESOCKETENGINE_DEBUG
+ qDebug() << "QSymbianSocketEnginePrivate::createNewSocket - _q_networksession was set" << connection;
+#endif
+ }
TInt err;
-// if (connection)
-// err = nativeSocket.Open(socketServer, family, type, protocol, *connection);
-// else
+ if (connection) {
+ if (connection->SubSessionHandle())
+ err = nativeSocket.Open(socketServer, family, type, protocol, *connection);
+ else {
+ setError(QAbstractSocket::NetworkError, SessionNotOpenErrorString);
+ return false;
+ }
+ } else
err = nativeSocket.Open(socketServer, family, type, protocol); //TODO: FIXME - deprecated API, make sure we always have a connection instead
if (err != KErrNone) {
@@ -246,7 +263,6 @@ void QSymbianSocketEnginePrivate::setPortAndAddress(TInetAddr& nativeAddr, quint
QSymbianSocketEnginePrivate::QSymbianSocketEnginePrivate() :
socketDescriptor(-1),
socketServer(QSymbianSocketManager::instance().getSocketServer()),
- connection(QSymbianSocketManager::instance().defaultConnection()),
readNotifier(0),
writeNotifier(0),
exceptNotifier(0),
@@ -1330,9 +1346,12 @@ void QSymbianSocketEnginePrivate::setError(QAbstractSocket::SocketError error, E
case InvalidProxyTypeString:
socketErrorString = QSymbianSocketEngine::tr("The proxy type is invalid for this operation");
break;
- case InvalidAddressError:
+ case InvalidAddressErrorString:
socketErrorString = QSymbianSocketEngine::tr("The address is invalid for this operation");
break;
+ case SessionNotOpenErrorString:
+ socketErrorString = QSymbianSocketEngine::tr("The specified network session is not opened");
+ break;
case UnknownSocketErrorString:
socketErrorString = QSymbianSocketEngine::tr("Unknown error");
break;
@@ -1378,7 +1397,7 @@ void QSymbianSocketEnginePrivate::setError(TInt symbianError)
setError(QAbstractSocket::NetworkError, ConnectionTimeOutErrorString);
break;
case KErrBadName:
- setError(QAbstractSocket::NetworkError, InvalidAddressError);
+ setError(QAbstractSocket::NetworkError, InvalidAddressErrorString);
break;
default:
socketError = QAbstractSocket::NetworkError;
diff --git a/src/network/socket/qsymbiansocketengine_p.h b/src/network/socket/qsymbiansocketengine_p.h
index a2904ae..bc39450 100644
--- a/src/network/socket/qsymbiansocketengine_p.h
+++ b/src/network/socket/qsymbiansocketengine_p.h
@@ -196,8 +196,6 @@ public:
mutable RSocket nativeSocket;
// From QtCore:
RSocketServ& socketServer;
- // From QtCore, check lifetime issues, also should be pulling this out of a QNetworkSession somehow:
- RConnection *connection;
mutable RTimer selectTimer;
QSocketNotifier *readNotifier, *writeNotifier, *exceptNotifier;
@@ -231,7 +229,8 @@ public:
NotSocketErrorString,
InvalidProxyTypeString,
//symbian specific
- InvalidAddressError,
+ InvalidAddressErrorString,
+ SessionNotOpenErrorString,
UnknownSocketErrorString = -1
};
diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp
index e382830..6b012db 100644
--- a/src/network/socket/qtcpserver.cpp
+++ b/src/network/socket/qtcpserver.cpp
@@ -287,6 +287,10 @@ bool QTcpServer::listen(const QHostAddress &address, quint16 port)
delete d->socketEngine;
d->socketEngine = QAbstractSocketEngine::createSocketEngine(QAbstractSocket::TcpSocket, proxy, this);
+#ifndef QT_NO_BEARERMANAGEMENT
+ //copy network session down to the socket engine (if it has been set)
+ d->socketEngine->setProperty("_q_networksession", property("_q_networksession"));
+#endif
if (!d->socketEngine) {
d->serverSocketError = QAbstractSocket::UnsupportedSocketOperationError;
d->serverSocketErrorString = tr("Operation on socket is not supported");
@@ -412,6 +416,10 @@ bool QTcpServer::setSocketDescriptor(int socketDescriptor)
if (d->socketEngine)
delete d->socketEngine;
d->socketEngine = QAbstractSocketEngine::createSocketEngine(socketDescriptor, this);
+#ifndef QT_NO_BEARERMANAGEMENT
+ //copy network session down to the socket engine (if it has been set)
+ d->socketEngine->setProperty("_q_networksession", property("_q_networksession"));
+#endif
if (!d->socketEngine->initialize(socketDescriptor, QAbstractSocket::ListeningState)) {
d->serverSocketError = d->socketEngine->error();
d->serverSocketErrorString = d->socketEngine->errorString();
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 4252123..39b74d9 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -2000,6 +2000,10 @@ void QSslSocketPrivate::createPlainSocket(QIODevice::OpenMode openMode)
q->setPeerName(QString());
plainSocket = new QTcpSocket(q);
+#ifndef QT_NO_BEARERMANAGEMENT
+ //copy network session down to the plain socket (if it has been set)
+ plainSocket->setProperty("_q_networksession", q->property("_q_networksession"));
+#endif
q->connect(plainSocket, SIGNAL(connected()),
q, SLOT(_q_connectedSlot()),
Qt::DirectConnection);
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index 2167dbb..e35c01a 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -1535,6 +1535,11 @@ bool QNetworkSessionPrivateImpl::easyWlanTrueIapId(TUint32 &trueIapId) const
}
#endif
+RConnection* QNetworkSessionPrivateImpl::nativeSession()
+{
+ return &iConnection;
+}
+
ConnectionProgressNotifier::ConnectionProgressNotifier(QNetworkSessionPrivateImpl& owner, RConnection& connection)
: CActive(CActive::EPriorityUserInput), iOwner(owner), iConnection(connection)
{
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h
index a0e7a2a..f2a8a45 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.h
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.h
@@ -111,7 +111,8 @@ public:
quint64 bytesWritten() const;
quint64 bytesReceived() const;
quint64 activeTime() const;
-
+
+ RConnection* nativeSession();
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
public: // From MMobilityProtocolResp
void PreferredCarrierAvailable(TAccessPointInfo aOldAPInfo,
diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp
index 1b4b503..7e3cd75 100644
--- a/tests/auto/qftp/tst_qftp.cpp
+++ b/tests/auto/qftp/tst_qftp.cpp
@@ -50,6 +50,10 @@
#include <time.h>
#include <stdlib.h>
#include <QNetworkProxy>
+#include <QNetworkConfiguration>
+#include <qnetworkconfigmanager.h>
+#include <QNetworkSession>
+#include <QtNetwork/private/qnetworksession_p.h>
#include "../network-settings.h"
@@ -62,7 +66,9 @@
#define SRCDIR ""
#endif
-
+#ifndef QT_NO_BEARERMANAGEMENT
+Q_DECLARE_METATYPE(QNetworkConfiguration)
+#endif
class tst_QFtp : public QObject
{
@@ -148,6 +154,10 @@ private:
void renameCleanup( const QString &host, const QString &user, const QString &password, const QString &fileToDelete );
QFtp *ftp;
+#ifndef QT_NO_BEARERMANAGEMENT
+ QSharedPointer<QNetworkSession> networkSessionExplicit;
+ QSharedPointer<QNetworkSession> networkSessionImplicit;
+#endif
QList<int> ids; // helper to make sure that all expected signals are emitted
int current_id;
@@ -186,9 +196,9 @@ private:
const int bytesTotal_init = -10;
const int bytesDone_init = -10;
-tst_QFtp::tst_QFtp()
+tst_QFtp::tst_QFtp() :
+ ftp(0)
{
- Q_SET_DEFAULT_IAP
}
tst_QFtp::~tst_QFtp()
@@ -199,33 +209,62 @@ void tst_QFtp::initTestCase_data()
{
QTest::addColumn<bool>("setProxy");
QTest::addColumn<int>("proxyType");
+ QTest::addColumn<bool>("setSession");
- QTest::newRow("WithoutProxy") << false << 0;
- QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
+ QTest::newRow("WithoutProxy") << false << 0 << false;
+ QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy) << false;
//### doesn't work well yet.
//QTest::newRow("WithHttpProxy") << true << int(QNetworkProxy::HttpProxy);
+
+#ifndef QT_NO_BEARERMANAGEMENT
+ QTest::newRow("WithoutProxyWithSession") << false << 0 << true;
+ QTest::newRow("WithSocks5ProxyAndSession") << true << int(QNetworkProxy::Socks5Proxy) << true;
+#endif
}
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
+#endif
}
void tst_QFtp::cleanupTestCase()
{
+#ifndef QT_NO_BEARERMANAGEMENT
+ networkSessionExplicit.clear();
+ networkSessionImplicit.clear();
+#endif
}
void tst_QFtp::init()
{
QFETCH_GLOBAL(bool, setProxy);
+ QFETCH_GLOBAL(int, proxyType);
+ QFETCH_GLOBAL(bool, setSession);
if (setProxy) {
- QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080));
} else if (proxyType == QNetworkProxy::HttpProxy) {
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128));
}
}
+#ifndef QT_NO_BEARERMANAGEMENT
+ if (setSession) {
+ networkSessionExplicit = networkSessionImplicit;
+ if (!networkSessionExplicit->isOpen()) {
+ networkSessionExplicit->open();
+ QVERIFY(networkSessionExplicit->waitForOpened(30000));
+ }
+ } else {
+ networkSessionExplicit.clear();
+ }
+#endif
+ delete ftp;
ftp = 0;
ids.clear();
@@ -266,6 +305,12 @@ void tst_QFtp::cleanup()
if (setProxy) {
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
}
+
+ delete ftp;
+ ftp = 0;
+#ifndef QT_NO_BEARERMANAGEMENT
+ networkSessionExplicit.clear();
+#endif
}
void tst_QFtp::connectToHost_data()
@@ -289,6 +334,7 @@ void tst_QFtp::connectToHost()
QTestEventLoop::instance().enterLoop( 61 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -337,6 +383,7 @@ void tst_QFtp::connectToUnresponsiveHost()
QVERIFY( it.value().success == 0 );
delete ftp;
+ ftp = 0;
}
void tst_QFtp::login_data()
@@ -369,6 +416,7 @@ void tst_QFtp::login()
QTestEventLoop::instance().enterLoop( 30 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -415,6 +463,7 @@ void tst_QFtp::close()
QTestEventLoop::instance().enterLoop( 30 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -482,6 +531,7 @@ void tst_QFtp::list()
QTestEventLoop::instance().enterLoop( 30 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -542,6 +592,7 @@ void tst_QFtp::cd()
QTestEventLoop::instance().enterLoop( 30 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() ) {
QFAIL( "Network operation timed out" );
}
@@ -617,6 +668,7 @@ void tst_QFtp::get()
QTestEventLoop::instance().enterLoop( 50 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -743,6 +795,7 @@ void tst_QFtp::put()
break;
}
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -775,6 +828,7 @@ void tst_QFtp::put()
break;
}
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -792,6 +846,7 @@ void tst_QFtp::put()
QTestEventLoop::instance().enterLoop( timestep );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -860,6 +915,7 @@ void tst_QFtp::mkdir()
QTestEventLoop::instance().enterLoop( 30 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -884,6 +940,7 @@ void tst_QFtp::mkdir()
QTestEventLoop::instance().enterLoop( 30 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -903,6 +960,7 @@ void tst_QFtp::mkdir()
QTestEventLoop::instance().enterLoop( 30 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -942,6 +1000,7 @@ void tst_QFtp::mkdir2()
QVERIFY(commandFinishedSpy.at(3).at(1).toBool());
delete ftp;
+ ftp = 0;
}
void tst_QFtp::mkdir2Slot(int id, bool)
@@ -1019,6 +1078,7 @@ void tst_QFtp::renameInit( const QString &host, const QString &user, const QStri
QTestEventLoop::instance().enterLoop( 50 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -1043,6 +1103,7 @@ void tst_QFtp::renameCleanup( const QString &host, const QString &user, const QS
QTestEventLoop::instance().enterLoop( 30 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -1087,6 +1148,7 @@ void tst_QFtp::rename()
QTestEventLoop::instance().enterLoop( 30 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -1273,6 +1335,7 @@ void tst_QFtp::commandSequence()
QTestEventLoop::instance().enterLoop( 30 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -1330,6 +1393,7 @@ void tst_QFtp::abort()
break;
}
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -1367,6 +1431,7 @@ void tst_QFtp::abort()
QTestEventLoop::instance().enterLoop( 30 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -1425,6 +1490,7 @@ void tst_QFtp::bytesAvailable()
ftp->readAll();
QVERIFY( ftp->bytesAvailable() == 0 );
delete ftp;
+ ftp = 0;
}
void tst_QFtp::activeMode()
@@ -1497,6 +1563,7 @@ void tst_QFtp::proxy()
QTestEventLoop::instance().enterLoop( 50 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() ) {
QFAIL( "Network operation timed out" );
}
@@ -1512,7 +1579,6 @@ void tst_QFtp::proxy()
}
}
-
void tst_QFtp::binaryAscii()
{
QString file = "asciifile%1.txt";
@@ -1573,6 +1639,7 @@ void tst_QFtp::binaryAscii()
QTestEventLoop::instance().enterLoop( 30 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -1868,6 +1935,11 @@ void tst_QFtp::dataTransferProgress( qint64 done, qint64 total )
QFtp *tst_QFtp::newFtp()
{
QFtp *nFtp = new QFtp( this );
+#ifndef QT_NO_BEARERMANAGEMENT
+ if (networkSessionExplicit) {
+ nFtp->setProperty("_q_networksession", QVariant::fromValue(networkSessionExplicit));
+ }
+#endif
connect( nFtp, SIGNAL(commandStarted(int)),
SLOT(commandStarted(int)) );
connect( nFtp, SIGNAL(commandFinished(int,bool)),
@@ -1920,6 +1992,7 @@ bool tst_QFtp::fileExists( const QString &host, quint16 port, const QString &use
inFileDirExistsFunction = TRUE;
QTestEventLoop::instance().enterLoop( 30 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() ) {
// ### make this test work
qWarning("tst_QFtp::fileExists: Network operation timed out");
@@ -1970,6 +2043,7 @@ bool tst_QFtp::dirExists( const QString &host, quint16 port, const QString &user
inFileDirExistsFunction = TRUE;
QTestEventLoop::instance().enterLoop( 30 );
delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() ) {
// ### make this test work
// QFAIL( "Network operation timed out" );