summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-06-12 18:06:23 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-14 10:42:33 +0200
commit84e89c1e9e00d4fab576b876cfa80e92b5602982 (patch)
treebbe8c928a20bdbf71c3bf6305e64fa46f6c9d16c /tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
parentfeb06decfe5355a14c982f7ddb427a262ad2b393 (diff)
Convert uses of QTime as a timer to QElapsedTimer
Change-Id: I2297f61efa5adf9ea5194c7f3ff68574cbcf452c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp')
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 8867e4dbaa..e85147095c 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -32,6 +32,7 @@
#include <QtCore/QDataStream>
#include <QtCore/QUrl>
#include <QtCore/QEventLoop>
+#include <QtCore/QElapsedTimer>
#include <QtCore/QFile>
#include <QtCore/QRandomGenerator>
#include <QtCore/QRegularExpression>
@@ -1149,7 +1150,7 @@ protected:
}
// now write in "blocking mode", this is where the rate measuring starts
- QTime timer;
+ QElapsedTimer timer;
timer.start();
//const qint64 writtenBefore = dataIndex;
//qint64 measuredTotalBytes = wantedSize - writtenBefore;
@@ -1248,7 +1249,7 @@ protected:
}
qint64 bytesRead = 0;
- QTime stopWatch;
+ QElapsedTimer stopWatch;
stopWatch.start();
do {
if (device->bytesAvailable() == 0) {
@@ -5153,8 +5154,8 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp()
const int rate = 200; // in kB per sec
RateControlledReader reader(server, reply.data(), rate, bufferSize);
- QTime loopTime;
- loopTime.start();
+ QElapsedTimer loopTimer;
+ loopTimer.start();
const int result = waitForFinish(reply);
if (notEnoughDataForFastSender) {
@@ -5164,7 +5165,7 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp()
QVERIFY2(result == Success, msgWaitForFinished(reply));
- const int elapsedTime = loopTime.elapsed();
+ const int elapsedTime = loopTimer.elapsed();
server.wait();
reader.wrapUp();
@@ -5450,12 +5451,12 @@ void tst_QNetworkReply::rateControl()
RateControlledReader reader(sender, reply.data(), rate, 20);
// this test is designed to run for 25 seconds at most
- QTime loopTime;
- loopTime.start();
+ QElapsedTimer loopTimer;
+ loopTimer.start();
QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply));
- int elapsedTime = loopTime.elapsed();
+ int elapsedTime = loopTimer.elapsed();
if (!errorSpy.isEmpty()) {
qDebug() << "ERROR!" << errorSpy[0][0] << reply->errorString();
@@ -6125,8 +6126,8 @@ void tst_QNetworkReply::httpConnectionCount()
}
int pendingConnectionCount = 0;
- QTime time;
- time.start();
+ QElapsedTimer timer;
+ timer.start();
while(pendingConnectionCount <= 20) {
QTestEventLoop::instance().enterLoop(1);
@@ -6138,7 +6139,7 @@ void tst_QNetworkReply::httpConnectionCount()
}
// at max. wait 10 sec
- if (time.elapsed() > 10000)
+ if (timer.elapsed() > 10000)
break;
}