test/httpwstest.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
New commits: commit c25d63b0d4307c5804f851d0d2f2bd881f06799d Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Sat Mar 25 21:52:01 2017 -0400 wsd: more stable testCloseAfterClose test Change-Id: Iac9392dbe455ddc3e4742a5f239c1f78f2bfe2ac Reviewed-on: https://gerrit.libreoffice.org/35709 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/test/httpwstest.cpp b/test/httpwstest.cpp index b8ca72c9..22fce917 100644 --- a/test/httpwstest.cpp +++ b/test/httpwstest.cpp @@ -315,9 +315,11 @@ void HTTPWSTest::testCloseAfterClose() const auto testname = "closeAfterClose "; try { + std::cerr << testname << "Connecting and loading." << std::endl; auto socket = loadDocAndGetSocket("hello.odt", _uri, testname); // send normal socket shutdown + std::cerr << testname << "Disconnecting." << std::endl; socket->shutdown(); // 5 seconds timeout @@ -330,16 +332,28 @@ void HTTPWSTest::testCloseAfterClose() do { bytes = socket->receiveFrame(buffer, sizeof(buffer), flags); + std::cerr << testname << "Received [" << std::string(buffer, bytes) << "], flags: "<< std::hex << flags << std::dec << std::endl; } while (bytes > 0 && (flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) != Poco::Net::WebSocket::FRAME_OP_CLOSE); - std::cerr << "Received " << bytes << " bytes, flags: "<< std::hex << flags << std::dec << std::endl; + std::cerr << testname << "Received " << bytes << " bytes, flags: "<< std::hex << flags << std::dec << std::endl; - // no more messages is received. - bytes = socket->receiveFrame(buffer, sizeof(buffer), flags); - std::cerr << "Received " << bytes << " bytes, flags: "<< std::hex << flags << std::dec << std::endl; - CPPUNIT_ASSERT_EQUAL(0, bytes); - CPPUNIT_ASSERT_EQUAL(0, flags); + try + { + // no more messages is received. + bytes = socket->receiveFrame(buffer, sizeof(buffer), flags); + std::cerr << testname << "Received " << bytes << " bytes, flags: "<< std::hex << flags << std::dec << std::endl; + CPPUNIT_ASSERT_EQUAL(0, bytes); + CPPUNIT_ASSERT_EQUAL(0, flags); + } + catch (const Poco::Exception& exc) + { + // This is not unexpected, since WSD will close the socket after + // echoing back the shutdown status code. However, if it doesn't + // we assert above that it doesn't send any more data. + std::cerr << testname << "Error: " << exc.displayText() << std::endl; + + } } catch (const Poco::Exception& exc) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits