diff options
author | Ryan Chu <ryan.chu@qt.io> | 2019-06-30 02:05:18 +0200 |
---|---|---|
committer | Ryan Chu <ryan.chu@qt.io> | 2019-08-23 15:28:52 +0200 |
commit | a302c6108d79b02a339b4ca93d2fce0b58386d51 (patch) | |
tree | beef84d4c74018f73bc08838c902977d9ec54601 /tests | |
parent | b14f5f59a3ae96949e6a33302385a751d6448182 (diff) | |
download | qtwebsockets-a302c6108d79b02a339b4ca93d2fce0b58386d51.tar.gz |
Add the missing tests in tst_DataProcessor::frameTooSmall
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 <edward.welbourne@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/websockets/dataprocessor/tst_dataprocessor.cpp | 20 |
1 files 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<QVariant> arguments = errorSpy.takeFirst(); |