diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2020-12-02 17:19:35 +0100 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2020-12-04 00:17:46 +0100 |
commit | 0592369df4956d91019c09448e00d479a21fec8f (patch) | |
tree | aa520e7dc2763e2ce51acc365647612d76f1bcf6 /tests/auto/network/access | |
parent | 27f52942b422b47a1283d918e0a0bc8761382921 (diff) |
tst_qnetworkreply: stabilize and unblacklist getFromHttpIntoBuffer2
The test in general is fine, but it was making an assumption that the
first 5 readyRead emissions would never result in the whole message
being received. In certain scenarios with slowdown however it was still
possible that we would receive the whole message after just a few
readyReady emissions. While I didn't check it's most likely due to a
mechanic in the QNetworkReply machinery where we suppress some
emissions if we know there's more data just about to be available.
Task-number: QTBUG-88943
Change-Id: I0cf06edb34d4e86cc8a42c0f1cd7e8c35765f6ee
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests/auto/network/access')
-rw-r--r-- | tests/auto/network/access/qnetworkreply/BLACKLIST | 2 | ||||
-rw-r--r-- | tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 13 |
2 files changed, 7 insertions, 8 deletions
diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index 4f356a8596..f9c977a51b 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -11,8 +11,6 @@ osx linux [getFromHttpIntoBuffer] osx -[getFromHttpIntoBuffer2] -windows-10 [headFromHttp] windows-10 msvc-2017 [ioPostToHttpFromSocket] diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index fb64eedc58..2485b6f3ac 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -6897,13 +6897,8 @@ public: // bytesAvailable must never be 0 QVERIFY(bytesAvailable != 0); - if (bytesAvailableList.length() < 5) { - // We assume that the first few times the bytes available must be less than the complete size, e.g. - // the bytesAvailable() function works correctly in case of a downloadBuffer. - QVERIFY(bytesAvailable < uploadSize); - } if (!bytesAvailableList.isEmpty()) { - // Also check that the same bytesAvailable is not coming twice in a row + // Check that the same bytesAvailable is not coming twice in a row QVERIFY(bytesAvailableList.last() != bytesAvailable); } @@ -6915,6 +6910,12 @@ public: { // We should have already received all readyRead QVERIFY(!bytesAvailableList.isEmpty()); + for (int i = 0; i < std::min(int(bytesAvailableList.size() - 1), 5); ++i) { + // We assume that, at least, the first time the bytes available must be less than the + // complete size, e.g. the bytesAvailable() function works correctly in case of a + // downloadBuffer. + QVERIFY(bytesAvailableList.at(i) < uploadSize); + } QCOMPARE(bytesAvailableList.last(), uploadSize); } }; |