test/httpwserror.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
New commits: commit e665a2056512a5712a2a8dee0eee28fcb486d694 Author: Ashod Nakashian <[email protected]> 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 <[email protected]> Tested-by: Ashod Nakashian <[email protected]> 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() _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
