summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-02-07 16:38:31 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2018-02-08 05:06:41 +0000
commitf9858ee2f51095e84602156a29d9d9a57a607045 (patch)
treeed6b0d33e855923b19016a250ddf9812e2135f5e /tests/auto
parentb0673043cd54421b8b8fa401ced0abfe9060bdd1 (diff)
Fix race condition in tst_QWebEngineDownloads::downloadTwoLinks()
Accept the two requests might come out of order Change-Id: I313506d975ebf007fce3cd857baa742866b8f38b Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp b/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp
index 606fe5b12..79a5aa2dc 100644
--- a/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp
+++ b/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp
@@ -472,11 +472,16 @@ void tst_QWebEngineDownloads::downloadTwoLinks()
std::unique_ptr<HttpReqRep> file1RR(results.takeFirst());
QVERIFY(file1RR);
QCOMPARE(file1RR->requestMethod(), QByteArrayLiteral("GET"));
- QCOMPARE(file1RR->requestPath(), QByteArrayLiteral("/file1"));
QTRY_COMPARE(requestSpy.count(), 4);
std::unique_ptr<HttpReqRep> file2RR(results.takeFirst());
QVERIFY(file2RR);
QCOMPARE(file2RR->requestMethod(), QByteArrayLiteral("GET"));
+
+ // Handle one request overtaking the other
+ if (file1RR->requestPath() == QByteArrayLiteral("/file2"))
+ std::swap(file1RR, file2RR);
+
+ QCOMPARE(file1RR->requestPath(), QByteArrayLiteral("/file1"));
QCOMPARE(file2RR->requestPath(), QByteArrayLiteral("/file2"));
file1RR->setResponseHeader(QByteArrayLiteral("content-type"), QByteArrayLiteral("text/plain"));