summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2018-04-18 09:37:58 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2018-04-18 14:18:38 +0000
commit9865ecf9dbe545b57339366fc248f2eff8d1c41a (patch)
tree94336156d79ba2cb48b1281c2406d2e1a632f700
parent8e5f6e3bed6e123cc603f12d785c47eeee495f94 (diff)
h2 auto test - replace QEventLoop (and QTimer) with QTestEventLoop
QTestEventLoop (conveniently so) takes care of timeouts thus no external QTimer/handling logic needed at all. Change-Id: Id65ea928daec1e7d9380107e63916896f19d3d14 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--tests/auto/network/access/http2/http2.pro2
-rw-r--r--tests/auto/network/access/http2/tst_http2.cpp15
2 files changed, 4 insertions, 13 deletions
diff --git a/tests/auto/network/access/http2/http2.pro b/tests/auto/network/access/http2/http2.pro
index e130f30784..62b685e556 100644
--- a/tests/auto/network/access/http2/http2.pro
+++ b/tests/auto/network/access/http2/http2.pro
@@ -1,4 +1,4 @@
-QT += core core-private network network-private testlib
+QT = core core-private network network-private testlib
CONFIG += testcase parallel_test c++11
TARGET = tst_http2
diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp
index ecf4c5814a..fa56a35c29 100644
--- a/tests/auto/network/access/http2/tst_http2.cpp
+++ b/tests/auto/network/access/http2/tst_http2.cpp
@@ -110,8 +110,7 @@ private:
QThread *workerThread = nullptr;
QNetworkAccessManager manager;
- QEventLoop eventLoop;
- QTimer timer;
+ QTestEventLoop eventLoop;
int nRequests = 0;
int nSentRequests = 0;
@@ -146,11 +145,6 @@ tst_Http2::tst_Http2()
: workerThread(new QThread)
{
workerThread->start();
-
- timer.setInterval(10000);
- timer.setSingleShot(true);
-
- connect(&timer, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
}
tst_Http2::~tst_Http2()
@@ -497,15 +491,12 @@ void tst_Http2::clearHTTP2State()
void tst_Http2::runEventLoop(int ms)
{
- timer.setInterval(ms);
- timer.start();
- eventLoop.exec();
+ eventLoop.enterLoopMSecs(ms);
}
void tst_Http2::stopEventLoop()
{
- timer.stop();
- eventLoop.quit();
+ eventLoop.exitLoop();
}
Http2Server *tst_Http2::newServer(const Http2::RawSettings &serverSettings,