From 0592369df4956d91019c09448e00d479a21fec8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 2 Dec 2020 17:19:35 +0100 Subject: 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 --- tests/auto/network/access/qnetworkreply/BLACKLIST | 2 -- .../auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 13 +++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'tests/auto/network') 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); } }; -- cgit v1.2.3