summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-08-21 11:47:53 (GMT)
committerAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-08-21 11:51:04 (GMT)
commit80ba609f408fc1d2b12699ce3679f3a96b9b2565 (patch)
treec5c61675d3a14d1ac8a004ed9d7b370a7f766be9 /tests/auto
parenteff4b1c979a42cb2fa7a5a7bbb2cb74f7524e61c (diff)
downloadQt-80ba609f408fc1d2b12699ce3679f3a96b9b2565.zip
Qt-80ba609f408fc1d2b12699ce3679f3a96b9b2565.tar.gz
Qt-80ba609f408fc1d2b12699ce3679f3a96b9b2565.tar.bz2
Revisiting test cases.
Some values (timeouts) could be trimmed to be the same as on the other platforms. Others are different as we have to remember that Symbina is embedded pltform and that usually tests run in the emulator. Things need more time then. Reviewed-by: TrustMe
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp80
1 files changed, 32 insertions, 48 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 9d05fb8..645734e 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -523,16 +523,19 @@ public:
QTcpSocket *active = new QTcpSocket(this);
active->connectToHost("127.0.0.1", server.serverPort());
#ifndef Q_OS_SYMBIAN
- if (!active->waitForConnected(100))
+ // need more time as working with embedded
+ // device and testing from emualtor
+ // things tend to get slower
+ if (!active->waitForConnected(1000))
return false;
- if (!server.waitForNewConnection(100))
+ if (!server.waitForNewConnection(1000))
return false;
#else
- if (!active->waitForConnected(5000))
+ if (!active->waitForConnected(100))
return false;
- if (!server.waitForNewConnection(5000))
+ if (!server.waitForNewConnection(100))
return false;
#endif
QTcpSocket *passive = server.nextPendingConnection();
@@ -1823,11 +1826,7 @@ void tst_QNetworkReply::ioGetFromFtp()
DataReader reader(reply);
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-#ifdef Q_OS_SYMBIAN
- QTestEventLoop::instance().enterLoop(20);
-#else
QTestEventLoop::instance().enterLoop(10);
-#endif
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(reply->url(), request.url());
@@ -1857,19 +1856,11 @@ void tst_QNetworkReply::ioGetFromFtpWithReuse()
QSignalSpy spy(reply1, SIGNAL(finished()));
connect(reply2, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-#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()));
-#ifdef Q_OS_SYMBIAN
- QTestEventLoop::instance().enterLoop(20);
-#else
QTestEventLoop::instance().enterLoop(10);
-#endif
QVERIFY(!QTestEventLoop::instance().timeout());
}
@@ -2560,12 +2551,7 @@ void tst_QNetworkReply::ioGetWithManyProxies()
connect(&manager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
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*)),
@@ -2694,13 +2680,8 @@ void tst_QNetworkReply::ioPutToFileFromLocalSocket()
}
QLocalSocket active;
active.connectToServer(socketname);
-#ifndef Q_OS_SYMBIAN
QVERIFY2(server.waitForNewConnection(10), server.errorString().toLatin1().constData());
QVERIFY2(active.waitForConnected(10), active.errorString().toLatin1().constData());
-#else
- QVERIFY2(server.waitForNewConnection(5000), server.errorString().toLatin1().constData());
- QVERIFY2(active.waitForConnected(5000), active.errorString().toLatin1().constData());
-#endif
QVERIFY2(server.hasPendingConnections(), server.errorString().toLatin1().constData());
QLocalSocket *passive = server.nextPendingConnection();
@@ -2715,11 +2696,7 @@ void tst_QNetworkReply::ioPutToFileFromLocalSocket()
passive->setParent(reply);
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-#ifndef Q_OS_SYMBIAN
QTestEventLoop::instance().enterLoop(10);
-#else
- QTestEventLoop::instance().enterLoop(30);
-#endif
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(reply->url(), url);
@@ -2982,7 +2959,11 @@ void tst_QNetworkReply::ioPostToHttpFromSocket()
QSignalSpy authenticationRequiredSpy(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)));
QSignalSpy proxyAuthenticationRequiredSpy(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
+#ifdef Q_OS_SYMBIAN
+ QTestEventLoop::instance().enterLoop(6);
+#else
QTestEventLoop::instance().enterLoop(3);
+#endif
disconnect(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
this, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
@@ -3317,7 +3298,12 @@ void tst_QNetworkReply::uploadPerformance()
void tst_QNetworkReply::httpUploadPerformance()
{
+#ifdef Q_OS_SYMBIAN
+ // SHow some mercy for non-desktop platform/s
+ enum {UploadSize = 4*1024*1024}; // 4 MB
+#else
enum {UploadSize = 128*1024*1024}; // 128 MB
+#endif
ThreadedDataReaderHttpServer reader;
FixedSizeDataGenerator generator(UploadSize);
@@ -3382,8 +3368,12 @@ void tst_QNetworkReply::httpDownloadPerformance()
{
QFETCH(bool, serverSendsContentLength);
QFETCH(bool, chunkedEncoding);
-
+#ifdef Q_OS_SYMBIAN
+ // Show some mercy to non-desktop platform/s
+ enum {UploadSize = 4*1024*1024}; // 4 MB
+#else
enum {UploadSize = 128*1024*1024}; // 128 MB
+#endif
HttpDownloadPerformanceServer server(UploadSize, serverSendsContentLength, chunkedEncoding);
QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/?bare=1"));
@@ -3411,6 +3401,9 @@ void tst_QNetworkReply::downloadProgress_data()
#ifndef Q_OS_SYMBIAN
QTest::newRow("big") << 4096;
#else
+ // it can run even with 4096
+ // but it takes lot time
+ //especially on emulator
QTest::newRow("big") << 1024;
#endif
}
@@ -3441,20 +3434,11 @@ 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);
QVERIFY(!reply->isFinished());
@@ -3469,11 +3453,7 @@ 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);
QVERIFY(!reply->isRunning());
@@ -3762,11 +3742,7 @@ void tst_QNetworkReply::httpProxyCommands()
// wait for the finished signal
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-#ifdef Q_OS_SYMBIAN
- QTestEventLoop::instance().enterLoop(5);
-#else
QTestEventLoop::instance().enterLoop(1);
-#endif
QVERIFY(!QTestEventLoop::instance().timeout());
@@ -3797,7 +3773,15 @@ void tst_QNetworkReply::proxyChange()
QNetworkReplyPtr reply2 = manager.get(req);
connect(reply2, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+#ifdef Q_OS_SYMBIAN
+ // we need more time as:
+ // 1. running from the emulator
+ // 2. not perfect POSIX implementation
+ // 3. embedded device
+ QTestEventLoop::instance().enterLoop(20);
+#else
QTestEventLoop::instance().enterLoop(10);
+#endif
QVERIFY(!QTestEventLoop::instance().timeout());
if (finishedspy.count() == 0) {