[Libreoffice-commits] online.git: kit/ChildSession.cpp test/helpers.hpp test/httpwserror.cpp test/httpwstest.cpp test/TileCacheTests.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sun Feb 11 18:22:32 UTC 2018
kit/ChildSession.cpp | 18 ++++---
test/TileCacheTests.cpp | 112 ++++++++++++++++++++++++------------------------
test/helpers.hpp | 40 ++++++++---------
test/httpwserror.cpp | 4 -
test/httpwstest.cpp | 60 ++++++++++++-------------
5 files changed, 118 insertions(+), 116 deletions(-)
New commits:
commit 2562d8919a3a3b2ed013839b192c3ad342c30602
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Feb 11 13:16:42 2018 -0500
ut: log the test name for easier traceability
Change-Id: Icbcbb36857b748c2ac2d0d36a5c4c23609f5453a
Reviewed-on: https://gerrit.libreoffice.org/49568
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index efac21b3..c002e5e3 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -1307,28 +1307,30 @@ void ChildSession::rememberEventsForInactiveUser(const int type, const std::stri
}
}
-void ChildSession::updateSpeed() {
-
+void ChildSession::updateSpeed()
+{
std::chrono::steady_clock::time_point now(std::chrono::steady_clock::now());
- while(_cursorInvalidatedEvent.size() != 0 &&
- std::chrono::duration_cast<std::chrono::milliseconds>(now - _cursorInvalidatedEvent.front()).count() > _eventStorageIntervalMs)
+ while (_cursorInvalidatedEvent.size() != 0 &&
+ std::chrono::duration_cast<std::chrono::milliseconds>(now - _cursorInvalidatedEvent.front()).count() > _eventStorageIntervalMs)
{
_cursorInvalidatedEvent.pop();
}
+
_cursorInvalidatedEvent.push(now);
_docManager.updateEditorSpeeds(_viewId, _cursorInvalidatedEvent.size());
}
-int ChildSession::getSpeed() {
-
+int ChildSession::getSpeed()
+{
std::chrono::steady_clock::time_point now(std::chrono::steady_clock::now());
- while(_cursorInvalidatedEvent.size() > 0 &&
- std::chrono::duration_cast<std::chrono::milliseconds>(now - _cursorInvalidatedEvent.front()).count() > _eventStorageIntervalMs)
+ while (_cursorInvalidatedEvent.size() > 0 &&
+ std::chrono::duration_cast<std::chrono::milliseconds>(now - _cursorInvalidatedEvent.front()).count() > _eventStorageIntervalMs)
{
_cursorInvalidatedEvent.pop();
}
+
return _cursorInvalidatedEvent.size();
}
diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp
index e770e1ff..4d1bde30 100644
--- a/test/TileCacheTests.cpp
+++ b/test/TileCacheTests.cpp
@@ -211,15 +211,15 @@ void TileCacheTests::testSimpleCombine()
sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840");
- std::vector<char> tile1a = getResponseMessage(socket1, "tile:");
+ std::vector<char> tile1a = getResponseMessage(socket1, "tile:", testname);
CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile1a.empty());
- std::vector<char> tile1b = getResponseMessage(socket1, "tile:");
+ std::vector<char> tile1b = getResponseMessage(socket1, "tile:", testname);
CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile1b.empty());
sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840");
- tile1a = getResponseMessage(socket1, "tile:");
+ tile1a = getResponseMessage(socket1, "tile:", testname);
CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile1a.empty());
- tile1b = getResponseMessage(socket1, "tile:");
+ tile1b = getResponseMessage(socket1, "tile:", testname);
CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile1b.empty());
// Second.
@@ -228,9 +228,9 @@ void TileCacheTests::testSimpleCombine()
sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840");
- std::vector<char> tile2a = getResponseMessage(socket2, "tile:");
+ std::vector<char> tile2a = getResponseMessage(socket2, "tile:", testname);
CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile2a.empty());
- std::vector<char> tile2b = getResponseMessage(socket2, "tile:");
+ std::vector<char> tile2b = getResponseMessage(socket2, "tile:", testname);
CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile2b.empty());
}
@@ -657,8 +657,8 @@ void TileCacheTests::testSimultaneousTilesRenderedJustOnce()
sendTextFrame(socket1, "tile part=42 width=400 height=400 tileposx=1000 tileposy=2000 tilewidth=3000 tileheight=3000");
sendTextFrame(socket2, "tile part=42 width=400 height=400 tileposx=1000 tileposy=2000 tilewidth=3000 tileheight=3000");
- const auto response1 = assertResponseString(socket1, "tile:");
- const auto response2 = assertResponseString(socket2, "tile:");
+ const auto response1 = assertResponseString(socket1, "tile:", "client1 ");
+ const auto response2 = assertResponseString(socket2, "tile:", "client2 ");
if (!response1.empty() && !response2.empty())
{
@@ -677,8 +677,8 @@ void TileCacheTests::testLoad12ods()
{
try
{
- const char* testName = "load12ods ";
- std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("load12.ods", _uri, testName);
+ const char* testname = "load12ods ";
+ std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("load12.ods", _uri, testname);
int docSheet = -1;
int docSheets = 0;
@@ -689,10 +689,10 @@ void TileCacheTests::testLoad12ods()
// check document size
sendTextFrame(socket, "status");
- const auto response = assertResponseString(socket, "status:");
+ const auto response = assertResponseString(socket, "status:", testname);
parseDocSize(response.substr(7), "spreadsheet", docSheet, docSheets, docWidth, docHeight, docViewId);
- checkBlackTiles(socket, docSheet, docWidth, docWidth, testName);
+ checkBlackTiles(socket, docSheet, docWidth, docWidth, testname);
}
catch (const Poco::Exception& exc)
{
@@ -767,21 +767,21 @@ void TileCacheTests::testTileInvalidateWriter()
std::string text = "Test. Now go 3 \"Enters\":\n\n\nNow after the enters, goes this text";
for (char ch : text)
{
- sendChar(socket, ch); // Send ordinary characters and wait for response -> one tile invalidation for each
+ sendChar(socket, ch, skNone, testname); // Send ordinary characters and wait for response -> one tile invalidation for each
assertResponseString(socket, "invalidatetiles:", testname);
}
text = "\n\n\n";
for (char ch : text)
{
- sendChar(socket, ch, skCtrl); // Send 3 Ctrl+Enter -> 3 new pages
+ sendChar(socket, ch, skCtrl, testname); // Send 3 Ctrl+Enter -> 3 new pages
assertResponseString(socket, "invalidatetiles:", testname);
}
text = "abcde";
for (char ch : text)
{
- sendChar(socket, ch);
+ sendChar(socket, ch, skNone, testname);
assertResponseString(socket, "invalidatetiles:", testname);
}
@@ -834,66 +834,66 @@ void TileCacheTests::testWriterAnyKey()
std::string f = fn.str();
const int istart = 474;
- sendText(socket, "\n"+s+"\n");
- sendKeyEvent(socket, "input", 0, i);
- sendKeyEvent(socket, "up", 0, i);
- sendText(socket, "\nEnd "+s+"\n");
+ sendText(socket, "\n"+s+"\n", testname);
+ sendKeyEvent(socket, "input", 0, i, testname);
+ sendKeyEvent(socket, "up", 0, i, testname);
+ sendText(socket, "\nEnd "+s+"\n", testname);
if (i>=istart)
sendTextFrame(socket, f);
- sendText(socket, "\n"+s+" With Shift:\n");
- sendKeyEvent(socket, "input", 0, i|skShift);
- sendKeyEvent(socket, "up", 0, i|skShift);
- sendText(socket, "\nEnd "+s+" With Shift\n");
+ sendText(socket, "\n"+s+" With Shift:\n", testname);
+ sendKeyEvent(socket, "input", 0, i|skShift, testname);
+ sendKeyEvent(socket, "up", 0, i|skShift, testname);
+ sendText(socket, "\nEnd "+s+" With Shift\n", testname);
if (i>=istart)
sendTextFrame(socket, f);
- sendText(socket, "\n"+s+" With Ctrl:\n");
- sendKeyEvent(socket, "input", 0, i|skCtrl);
- sendKeyEvent(socket, "up", 0, i|skCtrl);
- sendText(socket, "\nEnd "+s+" With Ctrl\n");
+ sendText(socket, "\n"+s+" With Ctrl:\n", testname);
+ sendKeyEvent(socket, "input", 0, i|skCtrl, testname);
+ sendKeyEvent(socket, "up", 0, i|skCtrl, testname);
+ sendText(socket, "\nEnd "+s+" With Ctrl\n", testname);
if (i>=istart)
sendTextFrame(socket, f);
- sendText(socket, "\n"+s+" With Alt:\n");
- sendKeyEvent(socket, "input", 0, i|skAlt);
- sendKeyEvent(socket, "up", 0, i|skAlt);
- sendText(socket, "\nEnd "+s+" With Alt\n");
+ sendText(socket, "\n"+s+" With Alt:\n", testname);
+ sendKeyEvent(socket, "input", 0, i|skAlt, testname);
+ sendKeyEvent(socket, "up", 0, i|skAlt, testname);
+ sendText(socket, "\nEnd "+s+" With Alt\n", testname);
if (i>=istart)
sendTextFrame(socket, f);
- sendText(socket, "\n"+s+" With Shift+Ctrl:\n");
- sendKeyEvent(socket, "input", 0, i|skShift|skCtrl);
- sendKeyEvent(socket, "up", 0, i|skShift|skCtrl);
- sendText(socket, "\nEnd "+s+" With Shift+Ctrl\n");
+ sendText(socket, "\n"+s+" With Shift+Ctrl:\n", testname);
+ sendKeyEvent(socket, "input", 0, i|skShift|skCtrl, testname);
+ sendKeyEvent(socket, "up", 0, i|skShift|skCtrl, testname);
+ sendText(socket, "\nEnd "+s+" With Shift+Ctrl\n", testname);
if (i>=istart)
sendTextFrame(socket, f);
- sendText(socket, "\n"+s+" With Shift+Alt:\n");
- sendKeyEvent(socket, "input", 0, i|skShift|skAlt);
- sendKeyEvent(socket, "up", 0, i|skShift|skAlt);
- sendText(socket, "\nEnd "+s+" With Shift+Alt\n");
+ sendText(socket, "\n"+s+" With Shift+Alt:\n", testname);
+ sendKeyEvent(socket, "input", 0, i|skShift|skAlt, testname);
+ sendKeyEvent(socket, "up", 0, i|skShift|skAlt, testname);
+ sendText(socket, "\nEnd "+s+" With Shift+Alt\n", testname);
if (i>=istart)
sendTextFrame(socket, f);
- sendText(socket, "\n"+s+" With Ctrl+Alt:\n");
- sendKeyEvent(socket, "input", 0, i|skCtrl|skAlt);
- sendKeyEvent(socket, "up", 0, i|skCtrl|skAlt);
- sendText(socket, "\nEnd "+s+" With Ctrl+Alt\n");
+ sendText(socket, "\n"+s+" With Ctrl+Alt:\n", testname);
+ sendKeyEvent(socket, "input", 0, i|skCtrl|skAlt, testname);
+ sendKeyEvent(socket, "up", 0, i|skCtrl|skAlt, testname);
+ sendText(socket, "\nEnd "+s+" With Ctrl+Alt\n", testname);
if (i>=istart)
sendTextFrame(socket, f);
- sendText(socket, "\n"+s+" With Shift+Ctrl+Alt:\n");
- sendKeyEvent(socket, "input", 0, i|skShift|skCtrl|skAlt);
- sendKeyEvent(socket, "up", 0, i|skShift|skCtrl|skAlt);
- sendText(socket, "\nEnd "+s+" With Shift+Ctrl+Alt\n");
+ sendText(socket, "\n"+s+" With Shift+Ctrl+Alt:\n", testname);
+ sendKeyEvent(socket, "input", 0, i|skShift|skCtrl|skAlt, testname);
+ sendKeyEvent(socket, "up", 0, i|skShift|skCtrl|skAlt, testname);
+ sendText(socket, "\nEnd "+s+" With Shift+Ctrl+Alt\n", testname);
if (i>=istart)
sendTextFrame(socket, f);
// This is to allow server to process the input, and check that everything is still OK
- sendTextFrame(socket, "status");
- getResponseMessage(socket, "status:");
+ sendTextFrame(socket, "status", testname);
+ getResponseMessage(socket, "status:", testname);
}
// sendTextFrame(socket, "saveas url=file:///tmp/emptyempty.odt format= options=");
}
@@ -906,7 +906,7 @@ void TileCacheTests::testTileInvalidateCalc()
std::string text = "Test. Now go 3 \"Enters\": Now after the enters, goes this text";
for (char ch : text)
{
- sendChar(socket, ch); // Send ordinary characters -> one tile invalidation for each
+ sendChar(socket, ch, skNone, testname); // Send ordinary characters -> one tile invalidation for each
assertResponseString(socket, "invalidatetiles:", testname);
}
@@ -914,14 +914,14 @@ void TileCacheTests::testTileInvalidateCalc()
text = "\n\n\n";
for (char ch : text)
{
- sendChar(socket, ch, skCtrl); // Send 3 Ctrl+Enter -> 3 new pages; I see 3 tiles invalidated for each
+ sendChar(socket, ch, skCtrl, testname); // Send 3 Ctrl+Enter -> 3 new pages; I see 3 tiles invalidated for each
assertResponseString(socket, "invalidatetiles:", testname);
}
text = "abcde";
for (char ch : text)
{
- sendChar(socket, ch);
+ sendChar(socket, ch, skNone, testname);
assertResponseString(socket, "invalidatetiles:", testname);
}
}
@@ -949,8 +949,8 @@ void TileCacheTests::testTileInvalidatePartCalc()
static const std::string text = "Some test";
for (char ch : text)
{
- sendChar(socket1, ch);
- sendChar(socket2, ch);
+ sendChar(socket1, ch, skNone, testname);
+ sendChar(socket2, ch, skNone, testname);
const auto response1 = assertResponseString(socket1, "invalidatetiles:", testname1);
int value1;
@@ -988,8 +988,8 @@ void TileCacheTests::testTileInvalidatePartImpress()
static const std::string text = "Some test";
for (char ch : text)
{
- sendChar(socket1, ch);
- sendChar(socket2, ch);
+ sendChar(socket1, ch, skNone, testname);
+ sendChar(socket2, ch, skNone, testname);
const auto response1 = assertResponseString(socket1, "invalidatetiles:", testname1);
int value1;
diff --git a/test/helpers.hpp b/test/helpers.hpp
index 67d5d97b..22b97dbc 100644
--- a/test/helpers.hpp
+++ b/test/helpers.hpp
@@ -140,7 +140,7 @@ void getDocumentPathAndURL(const std::string& docFilename, std::string& document
}
inline
-void sendTextFrame(LOOLWebSocket& socket, const std::string& string, const std::string& testname = "")
+void sendTextFrame(LOOLWebSocket& socket, const std::string& string, const std::string& testname)
{
#ifndef FUZZER
TST_LOG("Sending " << string.size() << " bytes: " << LOOLProtocol::getAbbreviatedMessage(string));
@@ -183,7 +183,7 @@ std::string const & getTestServerURI()
}
inline
-int getErrorCode(LOOLWebSocket& ws, std::string& message, const std::string& testname = "")
+int getErrorCode(LOOLWebSocket& ws, std::string& message, const std::string& testname)
{
int flags = 0;
int bytes = 0;
@@ -211,13 +211,13 @@ int getErrorCode(LOOLWebSocket& ws, std::string& message, const std::string& tes
}
inline
-int getErrorCode(const std::shared_ptr<LOOLWebSocket>& ws, std::string& message, const std::string& testname = "")
+int getErrorCode(const std::shared_ptr<LOOLWebSocket>& ws, std::string& message, const std::string& testname)
{
return getErrorCode(*ws, message, testname);
}
inline
-std::vector<char> getResponseMessage(LOOLWebSocket& ws, const std::string& prefix, const std::string& testname = "", const size_t timeoutMs = 10000)
+std::vector<char> getResponseMessage(LOOLWebSocket& ws, const std::string& prefix, const std::string& testname, const size_t timeoutMs = 10000)
{
try
{
@@ -305,20 +305,20 @@ std::vector<char> getResponseMessage(LOOLWebSocket& ws, const std::string& prefi
}
inline
-std::vector<char> getResponseMessage(const std::shared_ptr<LOOLWebSocket>& ws, const std::string& prefix, const std::string& testname = "", const size_t timeoutMs = 10000)
+std::vector<char> getResponseMessage(const std::shared_ptr<LOOLWebSocket>& ws, const std::string& prefix, const std::string& testname, const size_t timeoutMs = 10000)
{
return getResponseMessage(*ws, prefix, testname, timeoutMs);
}
template <typename T>
-std::string getResponseString(T& ws, const std::string& prefix, const std::string& testname = "", const size_t timeoutMs = 10000)
+std::string getResponseString(T& ws, const std::string& prefix, const std::string& testname, const size_t timeoutMs = 10000)
{
const auto response = getResponseMessage(ws, prefix, testname, timeoutMs);
return std::string(response.data(), response.size());
}
template <typename T>
-std::string assertResponseString(T& ws, const std::string& prefix, const std::string testname = "")
+std::string assertResponseString(T& ws, const std::string& prefix, const std::string testname)
{
const auto res = getResponseString(ws, prefix, testname);
CPPUNIT_ASSERT_EQUAL(prefix, res.substr(0, prefix.length()));
@@ -327,7 +327,7 @@ std::string assertResponseString(T& ws, const std::string& prefix, const std::st
/// Assert that we don't get a response with the given prefix.
template <typename T>
-std::string assertNotInResponse(T& ws, const std::string& prefix, const std::string testname = "")
+std::string assertNotInResponse(T& ws, const std::string& prefix, const std::string testname)
{
const auto res = getResponseString(ws, prefix, testname, 1000);
CPPUNIT_ASSERT_MESSAGE(testname + "Did not expect getting message [" + res + "].", res.empty());
@@ -335,7 +335,7 @@ std::string assertNotInResponse(T& ws, const std::string& prefix, const std::str
}
inline
-bool isDocumentLoaded(LOOLWebSocket& ws, const std::string& testname = "", bool isView = true)
+bool isDocumentLoaded(LOOLWebSocket& ws, const std::string& testname, bool isView = true)
{
const std::string prefix = isView ? "status:" : "statusindicatorfinish:";
const auto message = getResponseString(ws, prefix, testname);
@@ -343,7 +343,7 @@ bool isDocumentLoaded(LOOLWebSocket& ws, const std::string& testname = "", bool
}
inline
-bool isDocumentLoaded(std::shared_ptr<LOOLWebSocket>& ws, const std::string& testname = "", bool isView = true)
+bool isDocumentLoaded(std::shared_ptr<LOOLWebSocket>& ws, const std::string& testname, bool isView = true)
{
return isDocumentLoaded(*ws, testname, isView);
}
@@ -357,7 +357,7 @@ std::shared_ptr<LOOLWebSocket>
connectLOKit(const Poco::URI& uri,
Poco::Net::HTTPRequest& request,
Poco::Net::HTTPResponse& response,
- const std::string& testname = "")
+ const std::string& testname)
{
TST_LOG_BEGIN("Connecting... ");
int retries = 10;
@@ -390,7 +390,7 @@ connectLOKit(const Poco::URI& uri,
}
inline
-std::shared_ptr<LOOLWebSocket> loadDocAndGetSocket(const Poco::URI& uri, const std::string& documentURL, const std::string& testname = "", bool isView = true)
+std::shared_ptr<LOOLWebSocket> loadDocAndGetSocket(const Poco::URI& uri, const std::string& documentURL, const std::string& testname, bool isView = true)
{
try
{
@@ -415,7 +415,7 @@ std::shared_ptr<LOOLWebSocket> loadDocAndGetSocket(const Poco::URI& uri, const s
}
inline
-std::shared_ptr<LOOLWebSocket> loadDocAndGetSocket(const std::string& docFilename, const Poco::URI& uri, const std::string& testname = "", bool isView = true)
+std::shared_ptr<LOOLWebSocket> loadDocAndGetSocket(const std::string& docFilename, const Poco::URI& uri, const std::string& testname, bool isView = true)
{
try
{
@@ -487,13 +487,13 @@ void parseDocSize(const std::string& message, const std::string& type,
}
inline
-std::vector<char> getTileMessage(LOOLWebSocket& ws, const std::string& testname = "")
+std::vector<char> getTileMessage(LOOLWebSocket& ws, const std::string& testname)
{
return getResponseMessage(ws, "tile", testname);
}
inline
-std::vector<char> assertTileMessage(LOOLWebSocket& ws, const std::string& testname = "")
+std::vector<char> assertTileMessage(LOOLWebSocket& ws, const std::string& testname)
{
const std::vector<char> response = getTileMessage(ws, testname);
@@ -512,7 +512,7 @@ std::vector<char> assertTileMessage(LOOLWebSocket& ws, const std::string& testna
}
inline
-std::vector<char> assertTileMessage(const std::shared_ptr<LOOLWebSocket>& ws, const std::string& testname = "")
+std::vector<char> assertTileMessage(const std::shared_ptr<LOOLWebSocket>& ws, const std::string& testname)
{
return assertTileMessage(*ws, testname);
}
@@ -551,7 +551,7 @@ inline int getCharKey(char ch, SpecialKey specialKeys)
return result | specialKeys;
}
-inline void sendKeyEvent(std::shared_ptr<LOOLWebSocket>& socket, const char* type, int chr, int key, const std::string& testname = "")
+inline void sendKeyEvent(std::shared_ptr<LOOLWebSocket>& socket, const char* type, int chr, int key, const std::string& testname)
{
std::ostringstream ssIn;
ssIn << "key type=" << type << " char=" << chr << " key=" << key;
@@ -564,12 +564,12 @@ inline void sendKeyPress(std::shared_ptr<LOOLWebSocket>& socket, int chr, int ke
sendKeyEvent(socket, "up", chr, key, testname);
}
-inline void sendChar(std::shared_ptr<LOOLWebSocket>& socket, char ch, SpecialKey specialKeys=skNone, const std::string& testname = "")
+inline void sendChar(std::shared_ptr<LOOLWebSocket>& socket, char ch, SpecialKey specialKeys, const std::string& testname)
{
sendKeyPress(socket, getCharChar(ch, specialKeys), getCharKey(ch, specialKeys), testname);
}
-inline void sendText(std::shared_ptr<LOOLWebSocket>& socket, const std::string& text, const std::string& testname = "")
+inline void sendText(std::shared_ptr<LOOLWebSocket>& socket, const std::string& text, const std::string& testname)
{
for (char ch : text)
{
@@ -609,7 +609,7 @@ inline void getServerVersion(LOOLWebSocket& socket,
const std::string& testname)
{
const std::string clientVersion = "loolclient 0.1";
- sendTextFrame(socket, clientVersion);
+ sendTextFrame(socket, clientVersion, testname);
std::vector<char> loVersion = getResponseMessage(socket, "lokitversion", testname);
std::string line = LOOLProtocol::getFirstLine(loVersion.data(), loVersion.size());
line = line.substr(strlen("lokitversion "));
diff --git a/test/httpwserror.cpp b/test/httpwserror.cpp
index 16c27d8f..0f53d831 100644
--- a/test/httpwserror.cpp
+++ b/test/httpwserror.cpp
@@ -97,10 +97,10 @@ void HTTPWSError::testBadDocLoadFail()
getDocumentPathAndURL("corrupted.odt", documentPath, documentURL, testname);
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
- std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response);
+ std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response, testname);
// Send a load request with incorrect password
- sendTextFrame(socket, "load url=" + documentURL);
+ sendTextFrame(socket, "load url=" + documentURL, testname);
const auto response = getResponseString(socket, "error:", testname);
Poco::StringTokenizer tokens(response, " ", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
diff --git a/test/httpwstest.cpp b/test/httpwstest.cpp
index 99bcff0e..7cb643a9 100644
--- a/test/httpwstest.cpp
+++ b/test/httpwstest.cpp
@@ -418,7 +418,7 @@ void HTTPWSTest::testConnectNoLoad()
std::shared_ptr<LOOLWebSocket> socket1 = connectLOKit(_uri, request, _response, testname2);
CPPUNIT_ASSERT_MESSAGE("Failed to connect.", socket1);
sendTextFrame(socket1, "load url=" + documentURL, testname2);
- CPPUNIT_ASSERT_MESSAGE("cannot load the document " + documentURL, isDocumentLoaded(socket1));
+ CPPUNIT_ASSERT_MESSAGE("cannot load the document " + documentURL, isDocumentLoaded(socket1, testname2));
// Connect but don't load second view.
TST_LOG_NAME(testname3, "Connecting third to disconnect without loading.");
@@ -429,7 +429,7 @@ void HTTPWSTest::testConnectNoLoad()
TST_LOG_NAME(testname2, "Getting status from first view.");
sendTextFrame(socket1, "status", testname2);
- assertResponseString(socket1, "status:");
+ assertResponseString(socket1, "status:", testname2);
TST_LOG_NAME(testname2, "Disconnecting second.");
socket1.reset();
@@ -610,12 +610,12 @@ void HTTPWSTest::testBadLoad()
getDocumentPathAndURL("hello.odt", documentPath, documentURL, testname);
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
- std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response);
+ std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response, testname);
// Before loading request status.
sendTextFrame(socket, "status");
- const auto line = assertResponseString(socket, "error:");
+ const auto line = assertResponseString(socket, "error:", testname);
CPPUNIT_ASSERT_EQUAL(std::string("error: cmd=status kind=nodocloaded"), line);
}
catch (const Poco::Exception& exc)
@@ -745,7 +745,7 @@ void HTTPWSTest::testSavePassiveOnDisconnect()
std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket(_uri, documentURL, testname);
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
- std::shared_ptr<LOOLWebSocket> socket2 = connectLOKit(_uri, request, _response);
+ std::shared_ptr<LOOLWebSocket> socket2 = connectLOKit(_uri, request, _response, testname);
sendTextFrame(socket, "uno .uno:SelectAll", testname);
sendTextFrame(socket, "uno .uno:Delete", testname);
@@ -964,11 +964,11 @@ void HTTPWSTest::testRenderingOptions()
const std::string options = "{\"rendering\":{\".uno:HideWhitespace\":{\"type\":\"boolean\",\"value\":\"true\"}}}";
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
- std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response);
+ std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response, testname);
sendTextFrame(socket, "load url=" + documentURL + " options=" + options);
sendTextFrame(socket, "status");
- const auto status = assertResponseString(socket, "status:");
+ const auto status = assertResponseString(socket, "status:", testname);
// Expected format is something like 'status: type=text parts=2 current=0 width=12808 height=1142'.
Poco::StringTokenizer tokens(status, " ", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
@@ -996,7 +996,7 @@ void HTTPWSTest::testPasswordProtectedDocumentWithoutPassword()
getDocumentPathAndURL("password-protected.ods", documentPath, documentURL, testname);
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
- std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response);
+ std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response, testname);
// Send a load request without password first
sendTextFrame(socket, "load url=" + documentURL);
@@ -1027,7 +1027,7 @@ void HTTPWSTest::testPasswordProtectedDocumentWithWrongPassword()
getDocumentPathAndURL("password-protected.ods", documentPath, documentURL, testname);
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
- std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response);
+ std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response, testname);
// Send a load request with incorrect password
sendTextFrame(socket, "load url=" + documentURL + " password=2");
@@ -1058,12 +1058,12 @@ void HTTPWSTest::testPasswordProtectedDocumentWithCorrectPassword()
getDocumentPathAndURL("password-protected.ods", documentPath, documentURL, testname);
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
- std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response);
+ std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response, testname);
// Send a load request with correct password
sendTextFrame(socket, "load url=" + documentURL + " password=1");
- CPPUNIT_ASSERT_MESSAGE("cannot load the document with correct password " + documentURL, isDocumentLoaded(socket));
+ CPPUNIT_ASSERT_MESSAGE("cannot load the document with correct password " + documentURL, isDocumentLoaded(socket, testname));
}
catch (const Poco::Exception& exc)
{
@@ -1085,12 +1085,12 @@ void HTTPWSTest::testPasswordProtectedOOXMLDocument()
getDocumentPathAndURL("password-protected.docx", documentPath, documentURL, testname);
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
- std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response);
+ std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response, testname);
// Send a load request with correct password
sendTextFrame(socket, "load url=" + documentURL + " password=abc");
- CPPUNIT_ASSERT_MESSAGE("cannot load the document with correct password " + documentURL, isDocumentLoaded(socket));
+ CPPUNIT_ASSERT_MESSAGE("cannot load the document with correct password " + documentURL, isDocumentLoaded(socket, testname));
}
catch (const Poco::Exception& exc)
{
@@ -1107,12 +1107,12 @@ void HTTPWSTest::testPasswordProtectedBinaryMSOfficeDocument()
getDocumentPathAndURL("password-protected.doc", documentPath, documentURL, testname);
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
- std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response);
+ std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response, testname);
// Send a load request with correct password
sendTextFrame(socket, "load url=" + documentURL + " password=abc");
- CPPUNIT_ASSERT_MESSAGE("cannot load the document with correct password " + documentURL, isDocumentLoaded(socket));
+ CPPUNIT_ASSERT_MESSAGE("cannot load the document with correct password " + documentURL, isDocumentLoaded(socket, testname));
}
catch (const Poco::Exception& exc)
{
@@ -1133,15 +1133,15 @@ void HTTPWSTest::testInsertDelete()
getDocumentPathAndURL("insert-delete.odp", documentPath, documentURL, testname);
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
- std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response);
+ std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response, testname);
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, testname));
// check total slides 1
TST_LOG("Expecting 1 slide.");
sendTextFrame(socket, "status");
- response = getResponseString(socket, "status:");
+ response = getResponseString(socket, "status:", testname);
CPPUNIT_ASSERT_MESSAGE("did not receive a status: message as expected", !response.empty());
getPartHashCodes(testname, response.substr(7), parts);
CPPUNIT_ASSERT_EQUAL(1, (int)parts.size());
@@ -1153,7 +1153,7 @@ void HTTPWSTest::testInsertDelete()
for (size_t it = 1; it <= 10; it++)
{
sendTextFrame(socket, "uno .uno:InsertPage");
- response = getResponseString(socket, "status:");
+ response = getResponseString(socket, "status:", testname);
CPPUNIT_ASSERT_MESSAGE("did not receive a status: message as expected", !response.empty());
getPartHashCodes(testname, response.substr(7), parts);
CPPUNIT_ASSERT_EQUAL(it + 1, parts.size());
@@ -1169,7 +1169,7 @@ void HTTPWSTest::testInsertDelete()
// Explicitly delete the nth slide.
sendTextFrame(socket, "setclientpart part=" + std::to_string(it));
sendTextFrame(socket, "uno .uno:DeletePage");
- response = getResponseString(socket, "status:");
+ response = getResponseString(socket, "status:", testname);
CPPUNIT_ASSERT_MESSAGE("did not receive a status: message as expected", !response.empty());
getPartHashCodes(testname, response.substr(7), parts);
CPPUNIT_ASSERT_EQUAL(11 - it, parts.size());
@@ -1182,7 +1182,7 @@ void HTTPWSTest::testInsertDelete()
for (size_t it = 1; it <= 10; it++)
{
sendTextFrame(socket, "uno .uno:Undo");
- response = getResponseString(socket, "status:");
+ response = getResponseString(socket, "status:", testname);
CPPUNIT_ASSERT_MESSAGE("did not receive a status: message as expected", !response.empty());
getPartHashCodes(testname, response.substr(7), parts);
CPPUNIT_ASSERT_EQUAL(it + 1, parts.size());
@@ -1197,7 +1197,7 @@ void HTTPWSTest::testInsertDelete()
for (size_t it = 1; it <= 10; it++)
{
sendTextFrame(socket, "uno .uno:Redo");
- response = getResponseString(socket, "status:");
+ response = getResponseString(socket, "status:", testname);
CPPUNIT_ASSERT_MESSAGE("did not receive a status: message as expected", !response.empty());
getPartHashCodes(testname, response.substr(7), parts);
CPPUNIT_ASSERT_EQUAL(11 - it, parts.size());
@@ -1208,7 +1208,7 @@ void HTTPWSTest::testInsertDelete()
// check total slides 1
TST_LOG("Expecting 1 slide.");
sendTextFrame(socket, "status");
- response = getResponseString(socket, "status:");
+ response = getResponseString(socket, "status:", testname);
CPPUNIT_ASSERT_MESSAGE("did not receive a status: message as expected", !response.empty());
getPartHashCodes(testname, response.substr(7), parts);
CPPUNIT_ASSERT_EQUAL(1, (int)parts.size());
@@ -1251,10 +1251,10 @@ void HTTPWSTest::testSlideShow()
getDocumentPathAndURL("setclientpart.odp", documentPath, documentURL, testname);
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
- std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response);
+ std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response, testname);
sendTextFrame(socket, "load url=" + documentURL, testname);
- CPPUNIT_ASSERT_MESSAGE("cannot load the document " + documentURL, isDocumentLoaded(socket));
+ CPPUNIT_ASSERT_MESSAGE("cannot load the document " + documentURL, isDocumentLoaded(socket, testname));
// request slide show
sendTextFrame(socket, "downloadas name=slideshow.svg id=slideshow format=svg options=", testname);
@@ -1324,7 +1324,7 @@ void HTTPWSTest::testInactiveClient()
std::shared_ptr<LOOLWebSocket> socket1 = loadDocAndGetSocket(_uri, documentURL, "inactiveClient-1 ");
// Connect another and go inactive.
- TST_LOG("Connecting second client.");
+ TST_LOG_NAME("inactiveClient-2 ", "Connecting second client.");
std::shared_ptr<LOOLWebSocket> socket2 = loadDocAndGetSocket(_uri, documentURL, "inactiveClient-2 ", true);
sendTextFrame(socket2, "userinactive", "inactiveClient-2 ");
@@ -2593,8 +2593,8 @@ void HTTPWSTest::testViewInfoMsg()
getDocumentPathAndURL("hello.odt", docPath, docURL, testname);
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, docURL);
- std::shared_ptr<LOOLWebSocket> socket0 = connectLOKit(_uri, request, _response);
- std::shared_ptr<LOOLWebSocket> socket1 = connectLOKit(_uri, request, _response);
+ std::shared_ptr<LOOLWebSocket> socket0 = connectLOKit(_uri, request, _response, testname);
+ std::shared_ptr<LOOLWebSocket> socket1 = connectLOKit(_uri, request, _response, testname);
std::string response;
int part, parts, width, height;
@@ -2662,8 +2662,8 @@ void HTTPWSTest::testUndoConflict()
getDocumentPathAndURL("empty.odt", docPath, docURL, testname);
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, docURL);
- std::shared_ptr<LOOLWebSocket> socket0 = connectLOKit(_uri, request, _response);
- std::shared_ptr<LOOLWebSocket> socket1 = connectLOKit(_uri, request, _response);
+ std::shared_ptr<LOOLWebSocket> socket0 = connectLOKit(_uri, request, _response, testname);
+ std::shared_ptr<LOOLWebSocket> socket1 = connectLOKit(_uri, request, _response, testname);
std::string response;
try
More information about the Libreoffice-commits
mailing list