test/Makefile.am      |    1 +
 test/UnitEachView.cpp |    4 ++--
 test/UnitHTTP.cpp     |    9 +++++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 717d3132b272a230fe68ad5a9cf665b65c99fc05
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Nov 17 08:46:19 2019 -0500
Commit:     Ashod Nakashian <ashnak...@gmail.com>
CommitDate: Mon Nov 25 17:05:49 2019 +0100

    test: improve unit-tests
    
    Change-Id: I2fd499886616809975d769632b183354d7feb32f
    Reviewed-on: https://gerrit.libreoffice.org/83046
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
    Tested-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/test/Makefile.am b/test/Makefile.am
index 1086c8110..48da1f182 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -98,6 +98,7 @@ fakesockettest_LDADD = $(CPPUNIT_LIBS)
 # unit test modules:
 unit_oob_la_SOURCES = UnitOOB.cpp
 unit_http_la_SOURCES = UnitHTTP.cpp
+unit_http_la_LIBADD = $(CPPUNIT_LIBS)
 unit_fuzz_la_SOURCES = UnitFuzz.cpp
 unit_admin_la_SOURCES = UnitAdmin.cpp
 unit_admin_la_LIBADD = $(CPPUNIT_LIBS)
diff --git a/test/UnitEachView.cpp b/test/UnitEachView.cpp
index 40f4b1302..230324592 100644
--- a/test/UnitEachView.cpp
+++ b/test/UnitEachView.cpp
@@ -154,8 +154,8 @@ UnitBase::TestResult 
UnitEachView::testGraphicViewSelectionImpress()
 
 UnitEachView::UnitEachView()
 {
-    // Double of the default.
-    setTimeout(60 * 1000);
+    // Quadruple the default.
+    setTimeout(120 * 1000);
 }
 
 void UnitEachView::invokeTest()
diff --git a/test/UnitHTTP.cpp b/test/UnitHTTP.cpp
index 6a9065864..b245b765a 100644
--- a/test/UnitHTTP.cpp
+++ b/test/UnitHTTP.cpp
@@ -93,7 +93,9 @@ public:
     bool expectString(const std::shared_ptr<Poco::Net::StreamSocket> &socket, 
const std::string& str)
     {
         std::vector<char> buffer(str.size() + 64);
-        int got = socket->receiveBytes(buffer.data(), str.size());
+        const int got = socket->receiveBytes(buffer.data(), str.size());
+        CPPUNIT_ASSERT_EQUAL(str, std::string(buffer.data(), got));
+
         if (got != (int)str.size() ||
             strncmp(buffer.data(), str.c_str(), got))
         {
@@ -168,9 +170,10 @@ public:
 
         char buffer[4096] = { 0, };
         int got = socket->receiveBytes(buffer, 4096);
-        std::string start =
+        static const std::string start =
             "HTTP/1.0 200 OK\r\n"
             "Content-Disposition: attachment; filename=\"test.txt\"\r\n";
+        CPPUNIT_ASSERT_EQUAL(start, std::string(buffer));
 
         if (strncmp(buffer, start.c_str(), start.size()))
         {
@@ -182,6 +185,7 @@ public:
         // TODO: check content-length etc.
 
         const char *ptr = strstr(buffer, "\r\n\r\n");
+        CPPUNIT_ASSERT_MESSAGE("Missing separator, got " + 
std::string(buffer), !ptr);
         if (!ptr)
         {
             std::cerr << "missing separator " << got << " '" << buffer << "\n";
@@ -191,6 +195,7 @@ public:
 
         // Oddly we need another read to get the content.
         got = socket->receiveBytes(buffer, 4096);
+        CPPUNIT_ASSERT_MESSAGE("No content returned.", got >= 0);
         if (got >=0 )
             buffer[got] = '\0';
         else
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to