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 | 84 |
4 files changed, 86 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 d651ce5..fe06563 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()); @@ -688,6 +697,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)); @@ -695,7 +706,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) @@ -858,7 +873,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"); @@ -954,7 +969,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()); @@ -1006,7 +1021,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 @@ -1036,7 +1051,7 @@ void tst_QNetworkReply::getFromFtp_data() void tst_QNetworkReply::getFromFtp() { - QFETCH(QString, referenceName); + QFETCH(QString, referenceName); QFETCH(QString, url); QFile reference(referenceName); @@ -1065,7 +1080,7 @@ void tst_QNetworkReply::getFromHttp_data() void tst_QNetworkReply::getFromHttp() { - QFETCH(QString, referenceName); + QFETCH(QString, referenceName); QFETCH(QString, url); QFile reference(referenceName); @@ -1103,7 +1118,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 @@ -1444,7 +1459,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()); @@ -1474,11 +1493,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()); } @@ -2167,7 +2194,11 @@ void tst_QNetworkReply::ioGetWithManyProxies() SLOT(sslErrors(QNetworkReply*,QList<QSslError>))); #endif +#ifndef Q_OS_SYMBIAN QTestEventLoop::instance().enterLoop(10); +#else + QTestEventLoop::instance().enterLoop(60); +#endif QVERIFY(!QTestEventLoop::instance().timeout()); manager.disconnect(SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), @@ -2333,18 +2364,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()); @@ -2560,7 +2592,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); @@ -2647,11 +2678,20 @@ void tst_QNetworkReply::downloadProgress() QFETCH(int, loopCount); for (int i = 1; i <= loopCount; ++i) { +#ifdef Q_OS_SYMBIAN + if(i % 500 == 0) { + qWarning("iteration %d", i); + } +#endif sender->write(data); 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); @@ -2664,7 +2704,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); @@ -2679,7 +2723,7 @@ void tst_QNetworkReply::uploadProgress_data() } void tst_QNetworkReply::uploadProgress() -{ +{ QFETCH(QByteArray, data); QTcpServer server; QVERIFY(server.listen()); @@ -2797,7 +2841,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"); @@ -2950,7 +2994,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(); |