[Libreoffice-commits] online.git: test/httpwserror.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Wed Jan 4 04:31:52 UTC 2017
test/httpwserror.cpp | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
New commits:
commit e665a2056512a5712a2a8dee0eee28fcb486d694
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Tue Jan 3 17:31:49 2017 -0500
wsd: fixup max documents unittest
Change-Id: Ie61abcf5ce486463de3556522e2c726926ee4039
Reviewed-on: https://gerrit.libreoffice.org/32714
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/test/httpwserror.cpp b/test/httpwserror.cpp
index c001abf..30eae2b 100644
--- a/test/httpwserror.cpp
+++ b/test/httpwserror.cpp
@@ -96,8 +96,16 @@ void HTTPWSError::testNoExtraLoolKitsLeft()
void HTTPWSError::testMaxDocuments()
{
-#if MAX_DOCUMENTS > 0
+ static_assert(MAX_DOCUMENTS >= 2, "MAX_DOCUMENTS must be at least 2");
const auto testname = "maxDocuments ";
+
+ if (MAX_DOCUMENTS > 50)
+ {
+ std::cerr << "Skipping " << testname << "test since MAX_DOCUMENTS (" << MAX_DOCUMENTS
+ << ") is too high to test. Set to a more sensible number, ideally a dozen or so." << std::endl;
+ return;
+ }
+
try
{
// Load a document.
@@ -117,13 +125,11 @@ void HTTPWSError::testMaxDocuments()
std::string docURL;
getDocumentPathAndURL("empty.odt", docPath, docURL);
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, docURL);
- std::unique_ptr<Poco::Net::HTTPClientSession> session(helpers::createSession(_uri));
- LOOLWebSocket socket(*session, request, _response);
+ std::unique_ptr<Poco::Net::HTTPClientSession> session(createSession(_uri));
+ auto socket = std::make_shared<LOOLWebSocket>(*session, request, _response);
- // send loolclient, load and partpagerectangles
- sendTextFrame(socket, "loolclient ", testname);
- sendTextFrame(socket, "load ", testname);
- sendTextFrame(socket, "partpagerectangles ", testname);
+ // Send load request, which will fail.
+ sendTextFrame(socket, "load url=" + docURL, testname);
assertResponseString(socket, "error:", testname);
@@ -131,13 +137,12 @@ void HTTPWSError::testMaxDocuments()
const auto statusCode = getErrorCode(socket, message);
CPPUNIT_ASSERT_EQUAL(static_cast<int>(Poco::Net::WebSocket::WS_POLICY_VIOLATION), statusCode);
- socket.shutdown();
+ socket->shutdown();
}
catch (const Poco::Exception& exc)
{
CPPUNIT_FAIL(exc.displayText());
}
-#endif
}
void HTTPWSError::testMaxConnections()
More information about the Libreoffice-commits
mailing list