diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2019-06-12 18:06:23 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-14 10:42:33 +0200 |
commit | 84e89c1e9e00d4fab576b876cfa80e92b5602982 (patch) | |
tree | bbe8c928a20bdbf71c3bf6305e64fa46f6c9d16c /tests/auto/network/socket | |
parent | feb06decfe5355a14c982f7ddb427a262ad2b393 (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/socket')
5 files changed, 15 insertions, 13 deletions
diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp index 01168cc0d6..ffc63ee46a 100644 --- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp +++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp @@ -32,7 +32,7 @@ #include <qcoreapplication.h> #include <qdatastream.h> #include <qhostaddress.h> -#include <qdatetime.h> +#include <qelapsedtimer.h> #ifdef Q_OS_UNIX #include <unistd.h> @@ -403,7 +403,7 @@ void tst_PlatformSocketEngine::udpLoopbackPerformance() QHostAddress localhost = QHostAddress::LocalHost; qlonglong readBytes = 0; - QTime timer; + QElapsedTimer timer; timer.start(); while (timer.elapsed() < 5000) { udpSocket2.write(message1.data(), message1.size()); @@ -462,7 +462,7 @@ void tst_PlatformSocketEngine::tcpLoopbackPerformance() QByteArray message1(messageSize, '@'); QByteArray answer(messageSize, '@'); - QTime timer; + QElapsedTimer timer; timer.start(); qlonglong readBytes = 0; while (timer.elapsed() < 5000) { diff --git a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp index cdc6fef663..64241014d7 100644 --- a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp +++ b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp @@ -38,6 +38,7 @@ #include <qhostaddress.h> #include <qtcpsocket.h> #include <qdebug.h> +#include <qelapsedtimer.h> #include <qtcpserver.h> #include "../../../network-settings.h" @@ -397,7 +398,7 @@ void tst_QHttpSocketEngine::tcpLoopbackPerformance() QByteArray message1(messageSize, '@'); QByteArray answer(messageSize, '@'); - QTime timer; + QElapsedTimer timer; timer.start(); qlonglong readBytes = 0; while (timer.elapsed() < 30000) { @@ -629,7 +630,7 @@ void tst_QHttpSocketEngine::downloadBigFile() bytesAvailable = 0; - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); QTestEventLoop::instance().enterLoop(60); diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index f53c75c6a4..732f7eef00 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -32,6 +32,7 @@ #include <qtextstream.h> #include <qdatastream.h> +#include <qelapsedtimer.h> #include <QtNetwork/qlocalsocket.h> #include <QtNetwork/qlocalserver.h> @@ -1031,7 +1032,7 @@ void tst_QLocalSocket::waitForDisconnect() QLocalSocket *serverSocket = server.nextPendingConnection(); QVERIFY(serverSocket); socket.disconnectFromServer(); - QTime timer; + QElapsedTimer timer; timer.start(); QVERIFY(serverSocket->waitForDisconnected(3000)); QVERIFY(timer.elapsed() < 2000); diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index abe9845213..c500c6b3c3 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -66,7 +66,7 @@ #endif #include <QTextStream> #include <QThread> -#include <QTime> +#include <QElapsedTimer> #include <QTimer> #include <QDebug> // RVCT compiles also unused inline methods @@ -237,7 +237,6 @@ private: qint64 bytesAvailable; qint64 expectedLength; bool readingBody; - QTime timer; QByteArray expectedReplyIMAP_cached; @@ -1518,7 +1517,7 @@ void tst_QTcpSocket::downloadBigFile() expectedLength = 0; readingBody = false; - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); enterLoop(600); @@ -2482,7 +2481,7 @@ void tst_QTcpSocket::suddenRemoteDisconnect() QEventLoop loop; connect(&serverProcess, SIGNAL(finished(int)), &loop, SLOT(quit())); connect(&clientProcess, SIGNAL(finished(int)), &loop, SLOT(quit())); - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); QTimer::singleShot(20000, &loop, SLOT(quit())); @@ -2522,7 +2521,7 @@ void tst_QTcpSocket::connectToMultiIP() // rationale: this domain resolves to 3 A-records, 2 of them are // invalid. QTcpSocket should never spend more than 30 seconds per IP, and // 30s*2 = 60s. - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); socket->connectToHost("multi.dev.qt-project.org", 80); QVERIFY(socket->waitForConnected(60500)); @@ -2714,7 +2713,7 @@ void tst_QTcpSocket::taskQtBug5799ConnectionErrorWaitForConnected() QTcpSocket socket; socket.connectToHost(QtNetworkSettings::httpServerName(), 12346); - QTime timer; + QElapsedTimer timer; timer.start(); socket.waitForConnected(10000); QVERIFY2(timer.elapsed() < 9900, "Connection to closed port timed out instead of refusing, something is wrong"); diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index a4b22cb000..0f419e9de4 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -40,6 +40,7 @@ #include <qhostinfo.h> #include <qtcpsocket.h> #include <qmap.h> +#include <qelapsedtimer.h> #include <qnetworkdatagram.h> #include <QNetworkProxy> #include <QNetworkInterface> @@ -922,7 +923,7 @@ void tst_QUdpSocket::performance() client.connectToHost(serverAddress, server.localPort()); QVERIFY(client.waitForConnected(10000)); - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); qint64 nbytes = 0; |