loolwsd/test/TileCacheTests.cpp | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-)
New commits: commit 25c550ff8e264fd09ea6d17a925d9a348b0be327 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Wed May 4 08:34:31 2016 -0400 loolwsd: test that slow/hung clients don't block others Change-Id: I16697ab3afd1d209a77d48506604ec7babc1bfff Reviewed-on: https://gerrit.libreoffice.org/24655 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/loolwsd/test/TileCacheTests.cpp b/loolwsd/test/TileCacheTests.cpp index 81b9872..3fa077d 100644 --- a/loolwsd/test/TileCacheTests.cpp +++ b/loolwsd/test/TileCacheTests.cpp @@ -32,6 +32,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture CPPUNIT_TEST(testSimple); CPPUNIT_TEST(testSimpleCombine); + CPPUNIT_TEST(testUnresponsiveClient); CPPUNIT_TEST(testClientPartImpress); CPPUNIT_TEST(testClientPartCalc); #if ENABLE_DEBUG @@ -42,6 +43,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture void testSimple(); void testSimpleCombine(); + void testUnresponsiveClient(); void testClientPartImpress(); void testClientPartCalc(); void testSimultaneousTilesRenderedJustOnce(); @@ -173,7 +175,6 @@ void TileCacheTests::testSimpleCombine() tile1b = getResponseMessage(socket1, "tile:"); CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile1b.empty()); - sleep(4); std::cerr << "Connecting second client." << std::endl; auto socket2 = *loadDocAndGetSocket(_uri, documentURL); sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840"); @@ -187,6 +188,40 @@ void TileCacheTests::testSimpleCombine() socket2.shutdown(); } +void TileCacheTests::testUnresponsiveClient() +{ + std::string documentPath, documentURL; + getDocumentPathAndURL("hello.odt", documentPath, documentURL); + Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL); + + auto socket1 = *loadDocAndGetSocket(_uri, documentURL); + + getResponseMessage(socket1, "invalidatetiles"); + + std::cerr << "Connecting second client." << std::endl; + auto socket2 = *loadDocAndGetSocket(_uri, documentURL); + + // Pathologically request tiles and fail to read (say slow connection). + // Meanwhile, verify that others can get all tiles fine. + // TODO: Track memory consumption to verify we don't buffer too much. + for (auto x = 0; x < 5; ++x) + { + // As for tiles and don't read! + sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840"); + + // Verify that we get all 8 tiles. + sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840"); + for (auto i = 0; i < 8; ++i) + { + auto tile = getResponseMessage(socket2, "tile:"); + CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile.empty()); + } + } + + socket1.shutdown(); + socket2.shutdown(); +} + void TileCacheTests::testClientPartImpress() { try _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits