summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKurt Pattyn <pattyn.kurt@gmail.com>2013-09-01 13:49:00 +0200
committerKurt Pattyn <pattyn.kurt@gmail.com>2013-09-01 13:49:00 +0200
commit63231ee164859fbc468143da07fafc867a2ee301 (patch)
tree307672f02b0d5cff72023a3bd1f8a6507012a939 /tests
parent4350bed8cab2d5a4d41efa263e92cd308483a697 (diff)
downloadqtwebsockets-63231ee164859fbc468143da07fafc867a2ee301.tar.gz
Added maxMessageSize() and maxFrameSize() static getters to aid in unit testing
Diffstat (limited to 'tests')
-rw-r--r--tests/tst_dataprocessor.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/tests/tst_dataprocessor.cpp b/tests/tst_dataprocessor.cpp
index 8fe953f..3f89dc3 100644
--- a/tests/tst_dataprocessor.cpp
+++ b/tests/tst_dataprocessor.cpp
@@ -1107,10 +1107,7 @@ void tst_DataProcessor::frameTooBig_data()
//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
- //TODO: get maximum framesize from the frame somehow
- //the maximum framesize is currently defined as a constant in the dataprocessor_p.cpp file
- //and is set to MAX_INT; changing that value will make this test fail (which is not good)
- swapped64 = qToBigEndian<quint64>(quint64(INT_MAX + 1));
+ swapped64 = qToBigEndian<quint64>(DataProcessor::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)
@@ -1119,7 +1116,7 @@ void tst_DataProcessor::frameTooBig_data()
<< false
<< QWebSocketProtocol::CC_TOO_MUCH_DATA;
- swapped64 = qToBigEndian<quint64>(quint64(INT_MAX + 1));
+ swapped64 = qToBigEndian<quint64>(DataProcessor::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)
@@ -1128,7 +1125,7 @@ void tst_DataProcessor::frameTooBig_data()
<< false
<< QWebSocketProtocol::CC_TOO_MUCH_DATA;
- swapped64 = qToBigEndian<quint64>(quint64(INT_MAX + 1));
+ swapped64 = qToBigEndian<quint64>(DataProcessor::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)