Changed qnetworkreply unittest to return correct code

- Changed waitForFinished() to return correct return code

Change-Id: Ic6b0dfa195254783a2106011c4a108d907d73557
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
This commit is contained in:
Kurt Korbatits 2012-02-21 13:54:11 +10:00 committed by Qt by Nokia
parent 2a771cef4a
commit efb5a3a52e

View File

@ -1300,19 +1300,17 @@ QString tst_QNetworkReply::runCustomRequest(const QNetworkRequest &request,
int tst_QNetworkReply::waitForFinish(QNetworkReplyPtr &reply)
{
int code = Success;
int count = 0;
connect(reply, SIGNAL(finished()), SLOT(finished()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(gotError()));
returnCode = Success;
loop = new QEventLoop;
QSignalSpy spy(reply, SIGNAL(downloadProgress(qint64,qint64)));
while (!reply->isFinished()) {
QTimer::singleShot(10000, loop, SLOT(quit()));
code = loop->exec();
if (count == spy.count() && !reply->isFinished()) {
code = Timeout;
QTimer::singleShot(5000, loop, SLOT(quit()));
if ( loop->exec() == Timeout && count == spy.count() && !reply->isFinished()) {
returnCode = Timeout;
break;
}
count = spy.count();
@ -1320,7 +1318,7 @@ int tst_QNetworkReply::waitForFinish(QNetworkReplyPtr &reply)
delete loop;
loop = 0;
return code;
return returnCode;
}
void tst_QNetworkReply::finished()