diff options
Diffstat (limited to 'tests/auto/qnetworkreply')
-rw-r--r-- | tests/auto/qnetworkreply/.gitattributes | 5 | ||||
-rw-r--r-- | tests/auto/qnetworkreply/echo/echo.pro | 2 | ||||
-rw-r--r-- | tests/auto/qnetworkreply/test/test.pro | 16 | ||||
-rw-r--r-- | tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 79 |
4 files changed, 81 insertions, 21 deletions
diff --git a/tests/auto/qnetworkreply/.gitattributes b/tests/auto/qnetworkreply/.gitattributes index f0cae99..80252cf 100644 --- a/tests/auto/qnetworkreply/.gitattributes +++ b/tests/auto/qnetworkreply/.gitattributes @@ -1,2 +1,3 @@ -rfc3252.txt -crlf -bigfile -crlf +rfc3252.txt -crlf +bigfile -crlf +resource -crlf diff --git a/tests/auto/qnetworkreply/echo/echo.pro b/tests/auto/qnetworkreply/echo/echo.pro index bf791ff..74b0bfc 100644 --- a/tests/auto/qnetworkreply/echo/echo.pro +++ b/tests/auto/qnetworkreply/echo/echo.pro @@ -3,4 +3,4 @@ QT = core CONFIG -= app_bundle debug_and_release_target CONFIG += console - +symbian:TARGET.CAPABILITY="ALL -TCB" diff --git a/tests/auto/qnetworkreply/test/test.pro b/tests/auto/qnetworkreply/test/test.pro index 71f76a2..593de8b 100644 --- a/tests/auto/qnetworkreply/test/test.pro +++ b/tests/auto/qnetworkreply/test/test.pro @@ -10,7 +10,7 @@ win32 { } } -DEFINES += SRCDIR=\\\"$$PWD/..\\\" +!symbian:DEFINES += SRCDIR=\\\"$$PWD/..\\\" QT = core network RESOURCES += ../qnetworkreply.qrc @@ -20,3 +20,17 @@ wince*: { addFiles.path = . DEPLOYMENT += addFiles } + +symbian:{ + addFiles.sources = ../empty ../rfc3252.txt ../resource ../bigfile + addFiles.path = . + DEPLOYMENT += addFiles + + # Symbian toolchain does not support correct include semantics + INCPATH+=..\..\..\..\include\QtNetwork\private + # bigfile test case requires more heap + TARGET.EPOCHEAPSIZE="0x100 0x1000000" + TARGET.CAPABILITY="ALL -TCB" +} + + diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 104b788..d7faa73 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -67,8 +67,16 @@ #include "private/qnetworkaccessmanager_p.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Current path (C:\private\<UID>) contains only ascii chars +//#define SRCDIR QDir::currentPath() +#define SRCDIR "." +#endif + #include "../network-settings.h" + Q_DECLARE_METATYPE(QNetworkReply*) Q_DECLARE_METATYPE(QAuthenticator*) Q_DECLARE_METATYPE(QNetworkProxy) @@ -107,6 +115,7 @@ class tst_QNetworkReply: public QObject public: tst_QNetworkReply(); + ~tst_QNetworkReply(); QString runSimpleRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QNetworkReplyPtr &reply, const QByteArray &data = QByteArray()); @@ -684,6 +693,8 @@ protected: tst_QNetworkReply::tst_QNetworkReply() { + Q_SET_DEFAULT_IAP + testFileName = QDir::currentPath() + "/testfile"; #ifndef Q_OS_WINCE uniqueExtension = QString("%1%2%3").arg((qulonglong)this).arg(rand()).arg((qulonglong)time(0)); @@ -691,7 +702,11 @@ tst_QNetworkReply::tst_QNetworkReply() uniqueExtension = QString("%1%2").arg((qulonglong)this).arg(rand()); #endif cookieJar = new MyCookieJar; - manager.setCookieJar(cookieJar); + manager.setCookieJar(cookieJar); +} + +tst_QNetworkReply::~tst_QNetworkReply() +{ } void tst_QNetworkReply::authenticationRequired(QNetworkReply*, QAuthenticator* auth) @@ -854,7 +869,7 @@ void tst_QNetworkReply::invalidProtocol() void tst_QNetworkReply::getFromData_data() { - QTest::addColumn<QString>("request"); + QTest::addColumn<QString>("request"); QTest::addColumn<QByteArray>("expected"); QTest::addColumn<QString>("mimeType"); @@ -950,7 +965,7 @@ void tst_QNetworkReply::getFromData() void tst_QNetworkReply::getFromFile() { - // create the file: + // create the file: QTemporaryFile file(QDir::currentPath() + "/temp-XXXXXX"); file.setAutoRemove(true); QVERIFY(file.open()); @@ -1002,7 +1017,7 @@ void tst_QNetworkReply::getFromFileSpecial_data() void tst_QNetworkReply::getFromFileSpecial() { - QFETCH(QString, fileName); + QFETCH(QString, fileName); QFETCH(QString, url); // open the resource so we can find out its size @@ -1032,7 +1047,7 @@ void tst_QNetworkReply::getFromFtp_data() void tst_QNetworkReply::getFromFtp() { - QFETCH(QString, referenceName); + QFETCH(QString, referenceName); QFETCH(QString, url); QFile reference(referenceName); @@ -1061,7 +1076,7 @@ void tst_QNetworkReply::getFromHttp_data() void tst_QNetworkReply::getFromHttp() { - QFETCH(QString, referenceName); + QFETCH(QString, referenceName); QFETCH(QString, url); QFile reference(referenceName); @@ -1099,7 +1114,7 @@ void tst_QNetworkReply::getErrors_data() << int(QNetworkReply::ContentOperationNotPermittedError) << 0 << true; QTest::newRow("file-exist") << QUrl::fromLocalFile(QDir::currentPath() + "/this-file-doesnt-exist.txt").toString() << int(QNetworkReply::ContentNotFoundError) << 0 << true; -#if !defined Q_OS_WIN +#if !defined Q_OS_WIN && !defined(Q_OS_SYMBIAN) QTest::newRow("file-is-wronly") << QUrl::fromLocalFile(wronlyFileName).toString() << int(QNetworkReply::ContentAccessDenied) << 0 << true; #endif @@ -1440,7 +1455,11 @@ void tst_QNetworkReply::ioGetFromFtp() DataReader reader(reply); connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); - QTestEventLoop::instance().enterLoop(10); +#ifdef Q_OS_SYMBIAN + QTestEventLoop::instance().enterLoop(20); +#else + QTestEventLoop::instance().enterLoop(10); +#endif QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->url(), request.url()); @@ -1470,11 +1489,19 @@ void tst_QNetworkReply::ioGetFromFtpWithReuse() QSignalSpy spy(reply1, SIGNAL(finished())); connect(reply2, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); - QTestEventLoop::instance().enterLoop(10); +#ifdef Q_OS_SYMBIAN + QTestEventLoop::instance().enterLoop(20); +#else + QTestEventLoop::instance().enterLoop(10); +#endif QVERIFY(!QTestEventLoop::instance().timeout()); if (spy.count() == 0) { connect(reply1, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); - QTestEventLoop::instance().enterLoop(10); +#ifdef Q_OS_SYMBIAN + QTestEventLoop::instance().enterLoop(20); +#else + QTestEventLoop::instance().enterLoop(10); +#endif QVERIFY(!QTestEventLoop::instance().timeout()); } @@ -2116,7 +2143,11 @@ void tst_QNetworkReply::ioGetWithManyProxies() SLOT(sslErrors(QNetworkReply*,QList<QSslError>))); #endif +#ifndef Q_OS_SYMBIAN QTestEventLoop::instance().enterLoop(10); +#else + QTestEventLoop::instance().enterLoop(30); +#endif QVERIFY(!QTestEventLoop::instance().timeout()); manager.disconnect(SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), @@ -2282,18 +2313,19 @@ void tst_QNetworkReply::ioPutToFileFromProcess_data() void tst_QNetworkReply::ioPutToFileFromProcess() { -#if defined(Q_OS_WINCE) - QSKIP("Currently no stdin/out supported for Windows CE", SkipAll); +#if defined(Q_OS_WINCE) || defined (Q_OS_SYMBIAN) + QSKIP("Currently no stdin/out supported for Windows CE / Symbian OS", SkipAll); #endif + #ifdef Q_OS_WIN if (qstrcmp(QTest::currentDataTag(), "small") == 0) QSKIP("When passing a CR-LF-LF sequence through Windows stdio, it gets converted, " "so this test fails. Disabled on Windows", SkipSingle); #endif + #if defined(QT_NO_PROCESS) QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll); #else - QFile file(testFileName); QUrl url = QUrl::fromLocalFile(file.fileName()); @@ -2509,7 +2541,6 @@ void tst_QNetworkReply::downloadPerformance() { // unlike the above function, this one tries to send as fast as possible // and measures how fast it was. - TimedSender sender(5000); QNetworkRequest request("debugpipe://127.0.0.1:" + QString::number(sender.serverPort()) + "/?bare=1"); QNetworkReplyPtr reply = manager.get(request); @@ -2599,7 +2630,11 @@ void tst_QNetworkReply::downloadProgress() QVERIFY2(sender->waitForBytesWritten(2000), "Network timeout"); spy.clear(); +#ifdef Q_OS_SYMBIAN + QTestEventLoop::instance().enterLoop(5); +#else QTestEventLoop::instance().enterLoop(2); +#endif QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(spy.count() > 0); @@ -2612,7 +2647,11 @@ void tst_QNetworkReply::downloadProgress() delete sender; spy.clear(); +#ifdef Q_OS_SYMBIAN + QTestEventLoop::instance().enterLoop(5); +#else QTestEventLoop::instance().enterLoop(2); +#endif QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(spy.count() > 0); @@ -2627,7 +2666,7 @@ void tst_QNetworkReply::uploadProgress_data() } void tst_QNetworkReply::uploadProgress() -{ +{ QFETCH(QByteArray, data); QTcpServer server; QVERIFY(server.listen()); @@ -2744,7 +2783,7 @@ void tst_QNetworkReply::receiveCookiesFromHttp_data() void tst_QNetworkReply::receiveCookiesFromHttp() { - QFETCH(QString, cookieString); + QFETCH(QString, cookieString); QByteArray data = cookieString.toLatin1() + '\n'; QUrl url("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/set-cookie.cgi"); @@ -2897,7 +2936,13 @@ void tst_QNetworkReply::httpProxyCommands() // wait for the finished signal connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); - QTestEventLoop::instance().enterLoop(1); + +#ifdef Q_OS_SYMBIAN + QTestEventLoop::instance().enterLoop(5); +#else + QTestEventLoop::instance().enterLoop(1); +#endif + QVERIFY(!QTestEventLoop::instance().timeout()); //qDebug() << reply->error() << reply->errorString(); |