summaryrefslogtreecommitdiff
path: root/test/helpers.hpp
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-08-30 12:22:04 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-08-30 12:22:11 +0200
commit51b8ed7309979548c1f72918edab29b939eae488 (patch)
tree5117d6060e51d30f86c2a8238accdd86e7a3ab6f /test/helpers.hpp
parent8a3a17316ed17c37c1689cdac573305d0816ce49 (diff)
Try to avoid a timing problem in HTTPCrashTest::testRecoverAfterKitCrash()
In case we fail to open the document, try again in 2 seconds (same value as in HTTPServerTest::testConvertTo()). This seems to be needed fore core.git dbgutil builds, but don't do that unconditionally, in case the sleep is not needed for optimized core.git. Change-Id: I4585d1f273bfa5fffc4b02bc6107f27a2c9e1280
Diffstat (limited to 'test/helpers.hpp')
-rw-r--r--test/helpers.hpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/helpers.hpp b/test/helpers.hpp
index 708806cd2..19bf0b516 100644
--- a/test/helpers.hpp
+++ b/test/helpers.hpp
@@ -416,7 +416,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, bool isAssert = true)
{
try
{
@@ -426,7 +426,12 @@ std::shared_ptr<LOOLWebSocket> loadDocAndGetSocket(const Poco::URI& uri, const s
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, testname, isView));
+ bool isLoaded = isDocumentLoaded(*socket, testname, isView);
+ if (!isLoaded && !isAssert)
+ {
+ return nullptr;
+ }
+ CPPUNIT_ASSERT_MESSAGE("cannot load the document " + documentURL, isLoaded);
TST_LOG("Loaded document [" << documentURL << "].");
return socket;
@@ -441,13 +446,13 @@ 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, bool isAssert = true)
{
try
{
std::string documentPath, documentURL;
getDocumentPathAndURL(docFilename, documentPath, documentURL, testname);
- return loadDocAndGetSocket(uri, documentURL, testname, isView);
+ return loadDocAndGetSocket(uri, documentURL, testname, isView, isAssert);
}
catch (const Poco::Exception& exc)
{