Avoid busy wait in qnetworkreply test

Change-Id: Ie45d298cbb2ec3854d3ca3d416b9ebeff6d363f1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Jędrzej Nowacki 2014-12-15 23:20:34 +01:00
parent 972580accd
commit aeb64c3e24
1 changed files with 1 additions and 11 deletions

View File

@ -6340,17 +6340,7 @@ void tst_QNetworkReply::getAndThenDeleteObject()
reply->setReadBufferSize(1);
reply->setParent((QObject*)0); // must be 0 because else it is the manager
QTime stopWatch;
stopWatch.start();
forever {
QCoreApplication::instance()->processEvents();
if (reply->bytesAvailable())
break;
if (stopWatch.elapsed() >= 30000)
break;
}
QVERIFY(reply->bytesAvailable());
QTRY_VERIFY_WITH_TIMEOUT(reply->bytesAvailable(), 30000);
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
QVERIFY(!reply->isFinished()); // must not be finished