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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Apr 18 03:33:59 UTC 2016


 loolwsd/test/httpwstest.cpp |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

New commits:
commit 2ee7d35fb8c801829dfda341fd12ff66cb1075da
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Apr 17 20:33:26 2016 -0400

    loolwsd: reload test now actually reloads same document
    
    Change-Id: I2ff724d3a3566f5fcb010ce46a6749e517afccd2
    Reviewed-on: https://gerrit.libreoffice.org/24180
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index e7b1414..59de8a7 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -90,6 +90,8 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture
     void testImpressPartCountChanged();
     void testNoExtraLoolKitsLeft();
 
+    void loadDoc(const std::string& documentURL);
+
     static
     void sendTextFrame(Poco::Net::WebSocket& socket, const std::string& string);
 
@@ -268,14 +270,11 @@ void HTTPWSTest::testHandShake()
     }
 }
 
-void HTTPWSTest::testLoad()
+void HTTPWSTest::loadDoc(const std::string& documentURL)
 {
     try
     {
         // Load a document and get its status.
-        const std::string documentPath = Util::getTempFilePath(TDOC, "hello.odt");
-        const std::string documentURL = "file://" + Poco::Path(documentPath).makeAbsolute().toString();
-
         Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
         Poco::Net::WebSocket socket = *connectLOKit(request, _response);
 
@@ -308,7 +307,6 @@ void HTTPWSTest::testLoad()
         while (n > 0 && (flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) != Poco::Net::WebSocket::FRAME_OP_CLOSE);
 
         socket.shutdown();
-        Util::removeFile(documentPath);
     }
     catch (const Poco::Exception& exc)
     {
@@ -316,6 +314,14 @@ void HTTPWSTest::testLoad()
     }
 }
 
+void HTTPWSTest::testLoad()
+{
+    const std::string documentPath = Util::getTempFilePath(TDOC, "hello.odt");
+    const std::string documentURL = "file://" + Poco::Path(documentPath).makeAbsolute().toString();
+    loadDoc(documentURL);
+    Util::removeFile(documentPath);
+}
+
 void HTTPWSTest::testBadLoad()
 {
     try
@@ -365,10 +371,14 @@ void HTTPWSTest::testBadLoad()
 
 void HTTPWSTest::testReload()
 {
+    const std::string documentPath = Util::getTempFilePath(TDOC, "hello.odt");
+    const std::string documentURL = "file://" + Poco::Path(documentPath).makeAbsolute().toString();
     for (auto i = 0; i < 3; ++i)
     {
-        testLoad();
+        loadDoc(documentURL);
     }
+
+    Util::removeFile(documentPath);
 }
 
 void HTTPWSTest::testSaveOnDisconnect()


More information about the Libreoffice-commits mailing list