summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKurt Pattyn <pattyn.kurt@gmail.com>2013-09-01 19:40:27 +0200
committerKurt Pattyn <pattyn.kurt@gmail.com>2013-09-01 19:40:27 +0200
commit79b707102d0714574f390c878e0b57aff2e5e7ca (patch)
tree4656151d874c72237a9e8a59c964b988ef510de5 /tests
parent622bbc623efe26dbd7bd00fafc5deb7b8e1a6142 (diff)
downloadqtwebsockets-79b707102d0714574f390c878e0b57aff2e5e7ca.tar.gz
Open buffer in readonly mode iso readwrite mode
Diffstat (limited to 'tests')
-rw-r--r--tests/tst_dataprocessor.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/tst_dataprocessor.cpp b/tests/tst_dataprocessor.cpp
index f7d9e18..5c8d392 100644
--- a/tests/tst_dataprocessor.cpp
+++ b/tests/tst_dataprocessor.cpp
@@ -284,7 +284,7 @@ void tst_DataProcessor::goodBinaryFrames()
data.append(payload);
buffer.setData(data);
- buffer.open(QIODevice::ReadWrite);
+ buffer.open(QIODevice::ReadOnly);
QSignalSpy spyFrameReceived(&dataProcessor, SIGNAL(binaryFrameReceived(QByteArray,bool)));
QSignalSpy spyMessageReceived(&dataProcessor, SIGNAL(binaryMessageReceived(QByteArray)));
@@ -333,7 +333,7 @@ void tst_DataProcessor::goodTextFrames()
data.append(payload);
buffer.setData(data);
- buffer.open(QIODevice::ReadWrite);
+ buffer.open(QIODevice::ReadOnly);
QSignalSpy spyFrameReceived(&dataProcessor, SIGNAL(textFrameReceived(QString,bool)));
QSignalSpy spyMessageReceived(&dataProcessor, SIGNAL(textMessageReceived(QString)));
@@ -405,7 +405,7 @@ void tst_DataProcessor::nonCharacterCodes()
data.append(firstByte).append(secondByte);
data.append(payload);
buffer.setData(data);
- buffer.open(QIODevice::ReadWrite);
+ buffer.open(QIODevice::ReadOnly);
dataProcessor.process(&buffer);
QEXPECT_FAIL(QTest::currentDataTag(), "Due to QTextCode interpeting non-characters unicode points as invalid (QTBUG-33229).", Abort);
@@ -436,7 +436,7 @@ void tst_DataProcessor::frameTooSmall()
//with nothing in the buffer, the dataProcessor should time out and the error should be CC_GOING_AWAY
//meaning the socket will be closed
buffer.setData(data);
- buffer.open(QIODevice::ReadWrite);
+ buffer.open(QIODevice::ReadOnly);
QSignalSpy spy(&dataProcessor, SIGNAL(errorEncountered(QWebSocketProtocol::CloseCode,QString)));
QSignalSpy textMessageSpy(&dataProcessor, SIGNAL(textMessageReceived(QString)));
QSignalSpy binaryMessageSpy(&dataProcessor, SIGNAL(binaryMessageReceived(QByteArray)));
@@ -484,7 +484,7 @@ void tst_DataProcessor::frameTooSmall()
//text frame with final bit not set
data.append((char)(QWebSocketProtocol::OC_TEXT)).append(char(0x0));
buffer.setData(data);
- buffer.open(QIODevice::ReadWrite);
+ buffer.open(QIODevice::ReadOnly);
dataProcessor.process(&buffer);
buffer.close();
@@ -493,7 +493,7 @@ void tst_DataProcessor::frameTooSmall()
//with nothing in the buffer, the dataProcessor should time out and the error should be CC_GOING_AWAY
//meaning the socket will be closed
buffer.setData(data);
- buffer.open(QIODevice::ReadWrite);
+ buffer.open(QIODevice::ReadOnly);
QSignalSpy spy(&dataProcessor, SIGNAL(errorEncountered(QWebSocketProtocol::CloseCode,QString)));
dataProcessor.process(&buffer);
QCOMPARE(spy.count(), 1);
@@ -514,7 +514,7 @@ void tst_DataProcessor::frameTooSmall()
//text frame with final bit not set
data.append((char)(QWebSocketProtocol::OC_TEXT)).append(char(0x0));
buffer.setData(data);
- buffer.open(QIODevice::ReadWrite);
+ buffer.open(QIODevice::ReadOnly);
dataProcessor.process(&buffer);
QCOMPARE(textMessageSpy.count(), 0);
@@ -533,7 +533,7 @@ void tst_DataProcessor::frameTooSmall()
//only 1 byte follows in continuation frame; should time out with close code CC_GOING_AWAY
data.append('a');
buffer.setData(data);
- buffer.open(QIODevice::ReadWrite);
+ buffer.open(QIODevice::ReadOnly);
dataProcessor.process(&buffer);
QCOMPARE(spy.count(), 1);
@@ -600,7 +600,7 @@ void tst_DataProcessor::invalidPayloadInCloseFrame()
data.append(firstByte).append(secondByte);
data.append(payload);
buffer.setData(data);
- buffer.open(QIODevice::ReadWrite);
+ buffer.open(QIODevice::ReadOnly);
dataProcessor.process(&buffer);
QCOMPARE(spy.count(), 1);
QCOMPARE(textMessageSpy.count(), 0);
@@ -651,7 +651,7 @@ void tst_DataProcessor::doTest()
data.append(firstByte).append(secondByte);
data.append(payload);
buffer.setData(data);
- buffer.open(QIODevice::ReadWrite);
+ buffer.open(QIODevice::ReadOnly);
dataProcessor.process(&buffer);
QCOMPARE(spy.count(), 1);
QCOMPARE(textMessageSpy.count(), 0);