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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sun Oct 23 21:07:20 UTC 2016


 loolwsd/test/httpcrashtest.cpp |   31 ++++---------------------------
 1 file changed, 4 insertions(+), 27 deletions(-)

New commits:
commit 166b14a83a0d59b033152ac7e7696b07412acf22
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sat Oct 22 11:35:22 2016 -0400

    loolwsd: cleanup testBarren
    
    Change-Id: I5affeb7938e3b1373043e86799c991ef84d9b191
    Reviewed-on: https://gerrit.libreoffice.org/30201
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/test/httpcrashtest.cpp b/loolwsd/test/httpcrashtest.cpp
index ab8f018..ecaf4af 100644
--- a/loolwsd/test/httpcrashtest.cpp
+++ b/loolwsd/test/httpcrashtest.cpp
@@ -119,6 +119,7 @@ void HTTPCrashTest::testNoExtraLoolKitsLeft()
 void HTTPCrashTest::testBarren()
 {
     // Kill all kit processes and try loading a document.
+    const auto testname = "barren ";
     try
     {
         killLoKitProcesses();
@@ -126,35 +127,11 @@ void HTTPCrashTest::testBarren()
         std::cerr << "Loading after kill." << std::endl;
 
         // Load a document and get its status.
-        std::string documentPath, documentURL;
-        getDocumentPathAndURL("hello.odt", documentPath, documentURL);
+        auto socket = loadDocAndGetSocket("hello.odt", _uri, testname);
 
-        Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
-        auto socket = connectLOKit(_uri, request, _response);
+        sendTextFrame(socket, "status", testname);
+        assertResponseString(socket, "status:", testname);
 
-        // First load should fail.
-        sendTextFrame(socket, "load url=" + documentURL);
-        SocketProcessor("Barren ", socket, [&](const std::string& msg)
-                {
-                    const std::string prefix = "status: ";
-                    if (msg.find(prefix) == 0)
-                    {
-                        const auto status = msg.substr(prefix.length());
-                        CPPUNIT_ASSERT_EQUAL(std::string("type=text parts=1 current=0 width=12808 height=16408 viewid=0"), status);
-                        return false;
-                    }
-                    else if (msg.find("Service") == 0)
-                    {
-                        // Service unavailable. Try again.
-                        auto socket2 = loadDocAndGetSocket(_uri, documentURL);
-                        sendTextFrame(socket2, "status");
-                        const auto status = getResponseString(socket2, "status");
-                        CPPUNIT_ASSERT_EQUAL(std::string("type=text parts=1 current=0 width=12808 height=16408"), status);
-                        return false;
-                    }
-
-                    return true;
-                });
     }
     catch (const Poco::Exception& exc)
     {


More information about the Libreoffice-commits mailing list