[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3-0' - test/WopiTestServer.hpp

Pranav Kant pranavk at collabora.co.uk
Thu Feb 15 13:16:09 UTC 2018


 test/WopiTestServer.hpp |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 3181b25c352222f5b26f8e582fc670fa0811b988
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Feb 8 20:15:47 2018 +0530

    Try to act like a wopi test server bit more realistically
    
    Change-Id: If10a65a3e7740a752057f63072f1ada1be3552e7
    (cherry picked from commit cb0d65289907dca851c0a5386483b709c3dcd2df)
    Reviewed-on: https://gerrit.libreoffice.org/49756
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/test/WopiTestServer.hpp b/test/WopiTestServer.hpp
index aea66662..6efff2fb 100644
--- a/test/WopiTestServer.hpp
+++ b/test/WopiTestServer.hpp
@@ -34,6 +34,9 @@ protected:
     /// Content of the file.
     std::string _fileContent;
 
+    /// Last modified time of the file
+    Poco::Timestamp _fileLastModifiedTime;
+
 public:
     WopiTestServer(std::string fileContent = "Hello, world")
         : UnitWSD()
@@ -96,7 +99,7 @@ protected:
             fileInfo->set("UserFriendlyName", "test");
             fileInfo->set("UserCanWrite", "true");
             fileInfo->set("PostMessageOrigin", "localhost");
-            fileInfo->set("LastModifiedTime", Poco::DateTimeFormatter::format(now, Poco::DateTimeFormat::ISO8601_FORMAT));
+            fileInfo->set("LastModifiedTime", Poco::DateTimeFormatter::format(_fileLastModifiedTime, Poco::DateTimeFormat::ISO8601_FORMAT));
             fileInfo->set("EnableOwnerTermination", "true");
 
             std::ostringstream jsonStream;
@@ -107,7 +110,7 @@ protected:
 
             std::ostringstream oss;
             oss << "HTTP/1.1 200 OK\r\n"
-                << "Last-Modified: " << Poco::DateTimeFormatter::format(Poco::Timestamp(), Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n"
+                << "Last-Modified: " << Poco::DateTimeFormatter::format(_fileLastModifiedTime, Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n"
                 << "User-Agent: " << WOPI_AGENT_STRING << "\r\n"
                 << "Content-Length: " << responseString.size() << "\r\n"
                 << "Content-Type: " << mimeType << "\r\n"
@@ -130,7 +133,7 @@ protected:
 
             std::ostringstream oss;
             oss << "HTTP/1.1 200 OK\r\n"
-                << "Last-Modified: " << Poco::DateTimeFormatter::format(Poco::Timestamp(), Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n"
+                << "Last-Modified: " << Poco::DateTimeFormatter::format(_fileLastModifiedTime, Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n"
                 << "User-Agent: " << WOPI_AGENT_STRING << "\r\n"
                 << "Content-Length: " << _fileContent.size() << "\r\n"
                 << "Content-Type: " << mimeType << "\r\n"
@@ -155,7 +158,7 @@ protected:
 
             std::ostringstream oss;
             oss << "HTTP/1.1 200 OK\r\n"
-                << "Last-Modified: " << Poco::DateTimeFormatter::format(Poco::Timestamp(), Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n"
+                << "Last-Modified: " << Poco::DateTimeFormatter::format(_fileLastModifiedTime, Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n"
                 << "User-Agent: " << WOPI_AGENT_STRING << "\r\n"
                 << "Content-Length: " << content.size() << "\r\n"
                 << "Content-Type: application/json\r\n"
@@ -175,7 +178,7 @@ protected:
 
             std::ostringstream oss;
             oss << "HTTP/1.1 200 OK\r\n"
-                << "Last-Modified: " << Poco::DateTimeFormatter::format(Poco::Timestamp(), Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n"
+                << "Last-Modified: " << Poco::DateTimeFormatter::format(_fileLastModifiedTime, Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n"
                 << "User-Agent: " << WOPI_AGENT_STRING << "\r\n"
                 << "\r\n";
 


More information about the Libreoffice-commits mailing list