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

Henry Castro hcastro at collabora.com
Wed May 11 04:48:44 UTC 2016


 loolwsd/test/helpers.hpp |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit bd615ee9bc7ef56ae9b0a2cdbb06ac20a743549c
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed May 11 00:49:21 2016 -0400

    loolwsd: test: update isDocumentLoaded.
    
    When loading a view, it just send the status messages, because
    it is already loaded by main view id 0

diff --git a/loolwsd/test/helpers.hpp b/loolwsd/test/helpers.hpp
index 376afb5..2483049 100644
--- a/loolwsd/test/helpers.hpp
+++ b/loolwsd/test/helpers.hpp
@@ -71,7 +71,7 @@ void sendTextFrame(const std::shared_ptr<Poco::Net::WebSocket>& socket, const st
 }
 
 inline
-bool isDocumentLoaded(Poco::Net::WebSocket& ws, std::string name = "")
+bool isDocumentLoaded(Poco::Net::WebSocket& ws, std::string name = "", bool isView = false)
 {
     if (!name.empty())
     {
@@ -97,9 +97,8 @@ bool isDocumentLoaded(Poco::Net::WebSocket& ws, std::string name = "")
                 {
                     std::cerr << name << "Got " << bytes << " bytes: " << LOOLProtocol::getAbbreviatedMessage(buffer, bytes) << std::endl;
                     const std::string line = LOOLProtocol::getFirstLine(buffer, bytes);
-                    const std::string prefixIndicator = "statusindicatorfinish:";
-                    const std::string prefixStatus = "status:";
-                    if (line.find(prefixIndicator) == 0 || line.find(prefixStatus) == 0)
+                    const std::string prefix = isView ? "status:" : "statusindicatorfinish:";
+                    if (line.find(prefix) == 0)
                     {
                         isLoaded = true;
                         break;
@@ -331,7 +330,7 @@ connectLOKit(Poco::URI uri,
 }
 
 inline
-std::shared_ptr<Poco::Net::WebSocket> loadDocAndGetSocket(const Poco::URI& uri, const std::string& documentURL)
+std::shared_ptr<Poco::Net::WebSocket> loadDocAndGetSocket(const Poco::URI& uri, const std::string& documentURL, bool isView = false)
 {
     try
     {
@@ -341,7 +340,7 @@ std::shared_ptr<Poco::Net::WebSocket> loadDocAndGetSocket(const Poco::URI& uri,
         auto socket = connectLOKit(uri, request, response);
 
         sendTextFrame(socket, "load url=" + documentURL);
-        CPPUNIT_ASSERT_MESSAGE("cannot load the document " + documentURL, isDocumentLoaded(*socket));
+        CPPUNIT_ASSERT_MESSAGE("cannot load the document " + documentURL, isDocumentLoaded(*socket, "", isView));
 
         return socket;
     }


More information about the Libreoffice-commits mailing list