From a302c6108d79b02a339b4ca93d2fce0b58386d51 Mon Sep 17 00:00:00 2001 From: Ryan Chu Date: Sun, 30 Jun 2019 02:05:18 +0200 Subject: Add the missing tests in tst_DataProcessor::frameTooSmall MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are missing tests of 'text frame with final bit not set'. After dataProcessor.process, the spied signals should be compared and cleared before processing next frame. Change-Id: I5737da9d57e0043cfedb400f4e0934c5ce7c4250 Reviewed-by: Edward Welbourne Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Timur Pocheptsov --- .../websockets/dataprocessor/tst_dataprocessor.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/auto/websockets/dataprocessor/tst_dataprocessor.cpp b/tests/auto/websockets/dataprocessor/tst_dataprocessor.cpp index 705ea39..5390ff0 100644 --- a/tests/auto/websockets/dataprocessor/tst_dataprocessor.cpp +++ b/tests/auto/websockets/dataprocessor/tst_dataprocessor.cpp @@ -811,7 +811,23 @@ void tst_DataProcessor::frameTooSmall() dataProcessor.process(&buffer); QTRY_VERIFY_WITH_TIMEOUT(errorSpy.count(), 7000); + QCOMPARE(errorSpy.count(), 1); + QCOMPARE(closeSpy.count(), 0); + QCOMPARE(pingMessageSpy.count(), 0); + QCOMPARE(pongMessageSpy.count(), 0); + QCOMPARE(textMessageSpy.count(), 0); + QCOMPARE(binaryMessageSpy.count(), 0); + QCOMPARE(textFrameSpy.count(), 1); + QCOMPARE(binaryFrameSpy.count(), 0); + errorSpy.clear(); + closeSpy.clear(); + pingMessageSpy.clear(); + pongMessageSpy.clear(); + textMessageSpy.clear(); + binaryMessageSpy.clear(); + textFrameSpy.clear(); + binaryFrameSpy.clear(); buffer.close(); data.clear(); @@ -820,8 +836,6 @@ void tst_DataProcessor::frameTooSmall() //meaning the socket will be closed buffer.setData(data); buffer.open(QIODevice::ReadOnly); - QSignalSpy errorSpy(&dataProcessor, - SIGNAL(errorEncountered(QWebSocketProtocol::CloseCode,QString))); dataProcessor.process(&buffer); QTRY_VERIFY_WITH_TIMEOUT(errorSpy.count(), 7000); @@ -831,7 +845,7 @@ void tst_DataProcessor::frameTooSmall() QCOMPARE(pongMessageSpy.count(), 0); QCOMPARE(textMessageSpy.count(), 0); QCOMPARE(binaryMessageSpy.count(), 0); - QCOMPARE(textFrameSpy.count(), 1); + QCOMPARE(textFrameSpy.count(), 0); QCOMPARE(binaryFrameSpy.count(), 0); QList arguments = errorSpy.takeFirst(); -- cgit v1.2.1