[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - test/UnitOAuth.cpp test/UnitWOPI.cpp
Jan Holesovsky
kendy at collabora.com
Mon Oct 2 17:09:36 UTC 2017
test/UnitOAuth.cpp | 13 ++++++++-----
test/UnitWOPI.cpp | 13 ++++++++-----
2 files changed, 16 insertions(+), 10 deletions(-)
New commits:
commit 83e2cea098c5fdfbd125b277fa2e15a00dae7125
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed Sep 27 20:13:16 2017 +0200
Speed-up the WOPI tests.
Change-Id: Ib61c5b90703e4266dbad935cd632b8be50a4ac44
Reviewed-on: https://gerrit.libreoffice.org/42878
Reviewed-by: pranavk <pranavk at collabora.co.uk>
Tested-by: pranavk <pranavk at collabora.co.uk>
diff --git a/test/UnitOAuth.cpp b/test/UnitOAuth.cpp
index dcd2de65..f88a4b55 100644
--- a/test/UnitOAuth.cpp
+++ b/test/UnitOAuth.cpp
@@ -26,7 +26,7 @@ class UnitOAuth : public WopiTestServer
{
LoadToken, // loading the document with Bearer token
LoadHeader, // loading the document with Basic auth
- Finish // assert all went fine and finish
+ Polling // just wait for the results
} _phase;
bool _finishedToken;
@@ -82,6 +82,9 @@ public:
assertRequest(request, 1);
_finishedHeader = true;
}
+
+ if (_finishedToken && _finishedHeader)
+ exitTest(TestResult::Ok);
}
void assertPutFileRequest(const Poco::Net::HTTPRequest& /*request*/) override
@@ -104,17 +107,17 @@ public:
initWebsocket("/wopi/files/1?access_header=Authorization: Basic basic==");
helpers::sendTextFrame(*_ws->getLOOLWebSocket(), "load url=" + _wopiSrc, testName);
+ SocketPoll::wakeupWorld();
if (_phase == Phase::LoadToken)
_phase = Phase::LoadHeader;
else
- _phase = Phase::Finish;
+ _phase = Phase::Polling;
break;
}
- case Phase::Finish:
+ case Phase::Polling:
{
- CPPUNIT_ASSERT(_finishedToken && _finishedHeader);
- exitTest(TestResult::Ok);
+ // just wait for the results
break;
}
}
diff --git a/test/UnitWOPI.cpp b/test/UnitWOPI.cpp
index a1c7cbda..59f6282e 100644
--- a/test/UnitWOPI.cpp
+++ b/test/UnitWOPI.cpp
@@ -24,7 +24,7 @@ class UnitWOPI : public WopiTestServer
LoadAndSave,
Modify,
SaveModified,
- Finish
+ Polling
} _phase;
enum class SavingPhase
@@ -66,6 +66,9 @@ public:
CPPUNIT_ASSERT_EQUAL(std::string("true"), request.get("X-LOOL-WOPI-IsModifiedByUser"));
_finishedSaveModified = true;
}
+
+ if (_finishedSaveUnmodified && _finishedSaveModified)
+ exitTest(TestResult::Ok);
}
void invokeTest() override
@@ -83,6 +86,7 @@ public:
_phase = Phase::Modify;
_savingPhase = SavingPhase::Unmodified;
+ SocketPoll::wakeupWorld();
break;
}
case Phase::Modify:
@@ -97,14 +101,13 @@ public:
{
helpers::sendTextFrame(*_ws->getLOOLWebSocket(), "save dontTerminateEdit=0 dontSaveIfUnmodified=0", testName);
- _phase = Phase::Finish;
+ _phase = Phase::Polling;
_savingPhase = SavingPhase::Modified;
break;
}
- case Phase::Finish:
+ case Phase::Polling:
{
- CPPUNIT_ASSERT(_finishedSaveUnmodified && _finishedSaveModified);
- exitTest(TestResult::Ok);
+ // just wait for the results
break;
}
}
More information about the Libreoffice-commits
mailing list