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

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


 loolwsd/test/httpwstest.cpp |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 53a2e3ba427867d80bc6c9b4754f91338d2ae330
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Apr 17 20:34:19 2016 -0400

    loolwsd: save on disconnection test enabled and functional
    
    Change-Id: I604b0826674e981136ca7f8a9169a20eed9597d3
    Reviewed-on: https://gerrit.libreoffice.org/24181
    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 59de8a7..38e7f16 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -56,7 +56,7 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture
     CPPUNIT_TEST(testLoad);
     CPPUNIT_TEST(testBadLoad);
     CPPUNIT_TEST(testReload);
-    //CPPUNIT_TEST(testSaveOnDisconnect);
+    CPPUNIT_TEST(testSaveOnDisconnect);
     CPPUNIT_TEST(testExcelLoad);
     CPPUNIT_TEST(testPaste);
     CPPUNIT_TEST(testLargePaste);
@@ -383,12 +383,12 @@ void HTTPWSTest::testReload()
 
 void HTTPWSTest::testSaveOnDisconnect()
 {
+    const std::string documentPath = Util::getTempFilePath(TDOC, "hello.odt");
+    const std::string documentURL = "file://" + Poco::Path(documentPath).makeAbsolute().toString();
+
     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);
 
@@ -399,6 +399,7 @@ void HTTPWSTest::testSaveOnDisconnect()
         sendTextFrame(socket, "uno .uno:Delete");
         sendTextFrame(socket, "paste mimetype=text/plain;charset=utf-8\naaa bbb ccc");
 
+        // Shutdown abruptly.
         socket.shutdown();
     }
     catch (const Poco::Exception& exc)
@@ -406,12 +407,12 @@ void HTTPWSTest::testSaveOnDisconnect()
         CPPUNIT_FAIL(exc.displayText());
     }
 
+    // Allow time to save and destroy before we connect again.
+    sleep(5);
+    std::cout << "Loading again." << std::endl;
     try
     {
         // Load the same document and check that the last changes (pasted text) is saved.
-        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);
 


More information about the Libreoffice-commits mailing list