[Libreoffice-commits] online.git: loolwsd/DocumentBroker.cpp loolwsd/test

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Sep 1 04:08:12 UTC 2016


 loolwsd/DocumentBroker.cpp      |    4 ++--
 loolwsd/test/TileCacheTests.cpp |   17 ++++++++++++++++-
 loolwsd/test/httpwstest.cpp     |    1 +
 3 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit 534ab15d2fa3fa49740d0fb595232b7d90b39220
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed Aug 31 23:41:09 2016 -0400

    loolwsd: more aggressive test for unresponsive clients
    
    Change-Id: I9daf81661cf03be2ea38b5bc4d9688039912bd8a
    Reviewed-on: https://gerrit.libreoffice.org/28577
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index afa8460..2ae259f 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -491,7 +491,7 @@ void DocumentBroker::handleTileRequest(TileDesc& tile,
 #if ENABLE_DEBUG
         const std::string response = tile.serialize("tile:") + " renderid=cached\n";
 #else
-        const std::string response = tile.serialize("tile:") + "\n";
+        const std::string response = tile.serialize("tile:") + '\n';
 #endif
 
         std::vector<char> output;
@@ -501,7 +501,7 @@ void DocumentBroker::handleTileRequest(TileDesc& tile,
 
         assert(cachedTile->is_open());
         cachedTile->seekg(0, std::ios_base::end);
-        size_t pos = output.size();
+        const auto pos = output.size();
         std::streamsize size = cachedTile->tellg();
         output.resize(pos + size);
         cachedTile->seekg(0, std::ios_base::beg);
diff --git a/loolwsd/test/TileCacheTests.cpp b/loolwsd/test/TileCacheTests.cpp
index 5a2749d..f3d9564 100644
--- a/loolwsd/test/TileCacheTests.cpp
+++ b/loolwsd/test/TileCacheTests.cpp
@@ -234,8 +234,23 @@ void TileCacheTests::testUnresponsiveClient()
     // 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)
+
+    std::ostringstream oss;
+    for (auto i = 0; i < 1000; ++i)
+    {
+        oss << Util::encodeId(Util::rng::getNext(), 6);
+    }
+
+    const auto documentContents = oss.str();
+    for (auto x = 0; x < 8; ++x)
     {
+        // Invalidate to force re-rendering.
+        sendTextFrame(socket2, "uno .uno:SelectAll");
+        sendTextFrame(socket2, "uno .uno:Delete");
+        assertResponseLine(socket2, "invalidatetiles:", "client2 ");
+        sendTextFrame(socket2, "paste mimetype=text/html\n" + documentContents);
+        assertResponseLine(socket2, "invalidatetiles:", "client2 ");
+
         // Ask 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");
 
diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index 1dae4c3..f28c5d1 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -689,6 +689,7 @@ void HTTPWSTest::testLargePaste()
         {
             oss << Util::encodeId(Util::rng::getNext(), 6);
         }
+
         const auto documentContents = oss.str();
         std::cerr << "Pasting " << documentContents.size() << " characters into document." << std::endl;
         sendTextFrame(socket, "paste mimetype=text/html\n" + documentContents);


More information about the Libreoffice-commits mailing list