diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2010-12-08 19:16:27 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-12-08 19:20:13 (GMT) |
commit | afc7d05995c8f56d0ab9c35f9ca826e0bd0aaea4 (patch) | |
tree | 42b5ed91303fd4cb2e3aeac614f13ed9252d59f9 /tests/manual | |
parent | d7654f94c61d562c8673de577c1cf934f3026614 (diff) | |
download | Qt-afc7d05995c8f56d0ab9c35f9ca826e0bd0aaea4.zip Qt-afc7d05995c8f56d0ab9c35f9ca826e0bd0aaea4.tar.gz Qt-afc7d05995c8f56d0ab9c35f9ca826e0bd0aaea4.tar.bz2 |
Socket engines: Improve manual test program
Reviewed-by: Shane Kearns
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/socketengine/main.cpp | 36 | ||||
-rw-r--r-- | tests/manual/socketengine/socketengine.pro | 2 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/manual/socketengine/main.cpp b/tests/manual/socketengine/main.cpp index f368573..e475942 100644 --- a/tests/manual/socketengine/main.cpp +++ b/tests/manual/socketengine/main.cpp @@ -51,12 +51,48 @@ #include <private/qabstractsocketengine_p.h> #include <cstdio> #include <strings.h> +#include <QNetworkConfigurationManager> +#include <QNetworkConfiguration> +#include <QNetworkSession> +#include <QCoreApplication> const int bufsize = 16*1024; char buf[bufsize]; int main(int argc, char**argv) { + QCoreApplication app(argc, argv); + +#ifdef Q_OS_SYMBIAN + QNetworkConfigurationManager configurationManager; + QNetworkConfiguration configuration = configurationManager.defaultConfiguration(); + if (!configuration.isValid()) { + qDebug() << "Got an invalid session configuration"; + exit(1); + } + + qDebug() << "Opening session..."; + QNetworkSession *session = new QNetworkSession(configuration); + + // Does not work: +// session->open(); +// session->waitForOpened(); + + // works: + QEventLoop loop; + QObject::connect(session, SIGNAL(opened()), &loop, SLOT(quit()), Qt::QueuedConnection); + QMetaObject::invokeMethod(session, "open", Qt::QueuedConnection); + loop.exec(); + + + if (session->isOpen()) { + qDebug() << "session opened"; + } else { + qDebug() << "session could not be opened -" << session->errorString(); + exit(1); + } +#endif + // create it QAbstractSocketEngine *socketEngine = QAbstractSocketEngine::createSocketEngine(QAbstractSocket::TcpSocket, QNetworkProxy(QNetworkProxy::NoProxy), 0); diff --git a/tests/manual/socketengine/socketengine.pro b/tests/manual/socketengine/socketengine.pro index 96d0055..76a40be 100644 --- a/tests/manual/socketengine/socketengine.pro +++ b/tests/manual/socketengine/socketengine.pro @@ -9,5 +9,7 @@ QT += network CONFIG += release +symbian: TARGET.CAPABILITY = NetworkServices + # Input SOURCES += main.cpp |