#include <QByteArray>
#include <QDebug>
-#include "private/dataprocessor_p.h"
+#include "private/qwebsocketdataprocessor_p.h"
Q_DECLARE_METATYPE(QWebSocketProtocol::CloseCode)
Q_DECLARE_METATYPE(QWebSocketProtocol::OpCode)
//void goodHeaders(); //test all valid control codes
/*!
- Tests the DataProcessor for the correct handling of non-charactercodes
+ Tests the QWebSocketDataProcessor for the correct handling of non-charactercodes
Due to a workaround in QTextCodec, non-characters are treated as illegal.
This workaround is not necessary anymore, and hence code should be changed in Qt
to allow non-characters again.
* Unhappy Flows
***************************************************************************/
/*!
- \brief Tests the DataProcessor for correct handling of frames that don't contain the starting 2 bytes.
+ \brief Tests the QWebSocketDataProcessor for correct handling of frames that don't contain the starting 2 bytes.
This test is a border case, where not enough bytes are received to even start parsing a frame.
This test does not test sequences of frames, only single frames are tested
*/
void frameTooSmall();
/*!
- \brief Tests the DataProcessor for correct handling of frames that are oversized.
+ \brief Tests the QWebSocketDataProcessor for correct handling of frames that are oversized.
This test does not test sequences of frames, only single frames are tested
*/
void frameTooBig();
/*!
- \brief Tests the DataProcessor for the correct handling of malformed frame headers.
+ \brief Tests the QWebSocketDataProcessor for the correct handling of malformed frame headers.
This test does not test sequences of frames, only single frames are tested
*/
void invalidHeader();
/*!
- \brief Tests the DataProcessor for the correct handling of invalid control frames.
+ \brief Tests the QWebSocketDataProcessor for the correct handling of invalid control frames.
Invalid means: payload bigger than 125, frame is fragmented, ...
This test does not test sequences of frames, only single frames are tested
*/
void invalidCloseFrame();
/*!
- \brief Tests the DataProcess for the correct handling of incomplete size fields for large and big payloads.
+ \brief Tests the QWebSocketDataProcessor for the correct handling of incomplete size fields for large and big payloads.
*/
void incompleteSizeField();
/*!
- \brief Tests the DataProcessor for the correct handling of incomplete payloads.
+ \brief Tests the QWebSocketDataProcessor for the correct handling of incomplete payloads.
This includes:
- incomplete length bytes for large and big payloads (16- and 64-bit values),
- minimum size representation (see RFC 6455 paragraph 5.2),
void incompletePayload();
/*!
- \brief Tests the DataProcessor for the correct handling of invalid UTF-8 payloads.
+ \brief Tests the QWebSocketDataProcessor for the correct handling of invalid UTF-8 payloads.
This test does not test sequences of frames, only single frames are tested
*/
void invalidPayload();
void invalidPayloadInCloseFrame();
/*!
- Tests the DataProcessor for the correct handling of the minimum size representation requirement of RFC 6455 (see paragraph 5.2)
+ Tests the QWebSocketDataProcessor for the correct handling of the minimum size representation requirement of RFC 6455 (see paragraph 5.2)
*/
void minimumSizeRequirement();
{
QByteArray data;
QBuffer buffer;
- DataProcessor dataProcessor;
+ QWebSocketDataProcessor dataProcessor;
QFETCH(QByteArray, payload);
data.append((char)(FIN | QWebSocketProtocol::OC_BINARY));
{
QByteArray data;
QBuffer buffer;
- DataProcessor dataProcessor;
+ QWebSocketDataProcessor dataProcessor;
QFETCH(QByteArray, payload);
data.append((char)(FIN | QWebSocketProtocol::OC_TEXT));
{
QByteArray data;
QBuffer buffer;
- DataProcessor dataProcessor;
+ QWebSocketDataProcessor dataProcessor;
QFETCH(QString, payload);
QFETCH(QWebSocketProtocol::CloseCode, closeCode);
quint16 swapped = qToBigEndian<quint16>(closeCode);
QByteArray data;
QBuffer buffer;
- DataProcessor dataProcessor;
+ QWebSocketDataProcessor dataProcessor;
QSignalSpy frameSpy(&dataProcessor, SIGNAL(textFrameReceived(QString,bool)));
QSignalSpy messageSpy(&dataProcessor, SIGNAL(textMessageReceived(QString)));
QSignalSpy binaryFrameSpy(&dataProcessor, SIGNAL(binaryFrameReceived(QByteArray,bool)));
{
QByteArray data;
QBuffer buffer;
- DataProcessor dataProcessor;
+ QWebSocketDataProcessor dataProcessor;
QByteArray firstFrame;
firstFrame.append(quint8(QWebSocketProtocol::OC_TEXT)).append(char(1)).append(QByteArray(1, 'a'));
QByteArray data;
QBuffer buffer;
- DataProcessor dataProcessor;
+ QWebSocketDataProcessor dataProcessor;
QSignalSpy spy(&dataProcessor, SIGNAL(closeReceived(QWebSocketProtocol::CloseCode,QString)));
QSignalSpy textMessageSpy(&dataProcessor, SIGNAL(textMessageReceived(QString)));
QSignalSpy binaryMessageSpy(&dataProcessor, SIGNAL(binaryMessageReceived(QByteArray)));
QByteArray data;
QBuffer buffer;
- DataProcessor dataProcessor;
+ QWebSocketDataProcessor dataProcessor;
QSignalSpy spy(&dataProcessor, SIGNAL(errorEncountered(QWebSocketProtocol::CloseCode,QString)));
QSignalSpy textMessageSpy(&dataProcessor, SIGNAL(textMessageReceived(QString)));
QSignalSpy binaryMessageSpy(&dataProcessor, SIGNAL(binaryMessageReceived(QByteArray)));
QByteArray data;
QBuffer buffer;
- DataProcessor dataProcessor;
+ QWebSocketDataProcessor dataProcessor;
QSignalSpy spy(&dataProcessor, SIGNAL(closeReceived(QWebSocketProtocol::CloseCode,QString)));
QSignalSpy errorSpy(&dataProcessor, SIGNAL(errorEncountered(QWebSocketProtocol::CloseCode,QString)));
QSignalSpy textMessageSpy(&dataProcessor, SIGNAL(textMessageReceived(QString)));
//only data frames are checked for being too big
//control frames have explicit checking on a maximum payload size of 125, which is tested elsewhere
- swapped64 = qToBigEndian<quint64>(DataProcessor::maxFrameSize() + 1);
+ swapped64 = qToBigEndian<quint64>(QWebSocketDataProcessor::maxFrameSize() + 1);
wireRepresentation = static_cast<const char *>(static_cast<const void *>(&swapped64));
QTest::newRow("Text frame with payload size > INT_MAX")
<< quint8(FIN | QWebSocketProtocol::OC_TEXT)
<< false
<< QWebSocketProtocol::CC_TOO_MUCH_DATA;
- swapped64 = qToBigEndian<quint64>(DataProcessor::maxFrameSize() + 1);
+ swapped64 = qToBigEndian<quint64>(QWebSocketDataProcessor::maxFrameSize() + 1);
wireRepresentation = static_cast<const char *>(static_cast<const void *>(&swapped64));
QTest::newRow("Binary frame with payload size > INT_MAX")
<< quint8(FIN | QWebSocketProtocol::OC_BINARY)
<< false
<< QWebSocketProtocol::CC_TOO_MUCH_DATA;
- swapped64 = qToBigEndian<quint64>(DataProcessor::maxFrameSize() + 1);
+ swapped64 = qToBigEndian<quint64>(QWebSocketDataProcessor::maxFrameSize() + 1);
wireRepresentation = static_cast<const char *>(static_cast<const void *>(&swapped64));
QTest::newRow("Continuation frame with payload size > INT_MAX")
<< quint8(FIN | QWebSocketProtocol::OC_CONTINUE)