wsd: test: use LOK_ASSERT_STATE for more informative report
Change-Id: Ibd8589e3d6a2ca226578258c3cc1b9d85cad2d2c Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>pull/8441/head
parent
1896baa539
commit
25784d8677
|
@ -173,8 +173,7 @@ public:
|
||||||
// because only in that case there is no user input.
|
// because only in that case there is no user input.
|
||||||
LOK_ASSERT_MESSAGE("Expected reason to be 'Data-loss detected'",
|
LOK_ASSERT_MESSAGE("Expected reason to be 'Data-loss detected'",
|
||||||
reason.starts_with("Data-loss detected"));
|
reason.starts_with("Data-loss detected"));
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::WaitDocClose but was " + toString(_phase),
|
LOK_ASSERT_STATE(_phase, Phase::WaitDocClose);
|
||||||
_phase == Phase::WaitDocClose);
|
|
||||||
_unloadingModifiedDocDetected = true;
|
_unloadingModifiedDocDetected = true;
|
||||||
|
|
||||||
return failed();
|
return failed();
|
||||||
|
|
|
@ -168,8 +168,7 @@ public:
|
||||||
// because only in that case there is no user input.
|
// because only in that case there is no user input.
|
||||||
LOK_ASSERT_MESSAGE("Expected reason to be 'Data-loss detected'",
|
LOK_ASSERT_MESSAGE("Expected reason to be 'Data-loss detected'",
|
||||||
reason.starts_with("Data-loss detected"));
|
reason.starts_with("Data-loss detected"));
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::WaitDocClose but was " + toString(_phase),
|
LOK_ASSERT_STATE(_phase, Phase::WaitDocClose);
|
||||||
_phase == Phase::WaitDocClose);
|
|
||||||
_unloadingModifiedDocDetected = true;
|
_unloadingModifiedDocDetected = true;
|
||||||
|
|
||||||
return failed();
|
return failed();
|
||||||
|
@ -253,8 +252,7 @@ public:
|
||||||
// only have one session.
|
// only have one session.
|
||||||
LOK_ASSERT_MESSAGE("Expected reason to be 'Data-loss detected'",
|
LOK_ASSERT_MESSAGE("Expected reason to be 'Data-loss detected'",
|
||||||
reason.starts_with("Data-loss detected"));
|
reason.starts_with("Data-loss detected"));
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::WaitDocClose but was " + toString(_phase),
|
LOK_ASSERT_STATE(_phase, Phase::Done);
|
||||||
_phase == Phase::Done);
|
|
||||||
|
|
||||||
passTest("Data-loss detected as expected");
|
passTest("Data-loss detected as expected");
|
||||||
return failed();
|
return failed();
|
||||||
|
|
|
@ -150,8 +150,7 @@ public:
|
||||||
{
|
{
|
||||||
LOG_TST("FakeWOPIHost: Handling PutFile: " << uriReq.getPath());
|
LOG_TST("FakeWOPIHost: Handling PutFile: " << uriReq.getPath());
|
||||||
|
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::WaitPutFile",
|
LOK_ASSERT_STATE(_phase, Phase::WaitPutFile);
|
||||||
_phase == Phase::WaitPutFile);
|
|
||||||
|
|
||||||
LOK_ASSERT_MESSAGE("Always the default URI must be used for PutFile",
|
LOK_ASSERT_MESSAGE("Always the default URI must be used for PutFile",
|
||||||
regContent.match(uriReq.getPath()));
|
regContent.match(uriReq.getPath()));
|
||||||
|
@ -197,8 +196,7 @@ public:
|
||||||
bool onDocumentLoaded(const std::string& message) override
|
bool onDocumentLoaded(const std::string& message) override
|
||||||
{
|
{
|
||||||
LOG_TST("onDocumentLoaded: [" << message << ']');
|
LOG_TST("onDocumentLoaded: [" << message << ']');
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::WaitLoadStatus",
|
LOK_ASSERT_STATE(_phase, Phase::WaitLoadStatus);
|
||||||
_phase == Phase::WaitLoadStatus);
|
|
||||||
|
|
||||||
LOG_TST(
|
LOG_TST(
|
||||||
"onDocumentLoaded: Modifying the document and switching to Phase::WaitModifiedStatus");
|
"onDocumentLoaded: Modifying the document and switching to Phase::WaitModifiedStatus");
|
||||||
|
@ -213,8 +211,7 @@ public:
|
||||||
bool onDocumentModified(const std::string& message) override
|
bool onDocumentModified(const std::string& message) override
|
||||||
{
|
{
|
||||||
LOG_TST("onDocumentModified: [" << message << ']');
|
LOG_TST("onDocumentModified: [" << message << ']');
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::WaitModified",
|
LOK_ASSERT_STATE(_phase, Phase::WaitModifiedStatus);
|
||||||
_phase == Phase::WaitModifiedStatus);
|
|
||||||
|
|
||||||
LOG_TST("onDocumentModified: Saving document and switching to Phase::WaitPutFile");
|
LOG_TST("onDocumentModified: Saving document and switching to Phase::WaitPutFile");
|
||||||
TRANSITION_STATE(_phase, Phase::WaitPutFile);
|
TRANSITION_STATE(_phase, Phase::WaitPutFile);
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
|
|
||||||
assertCheckFileInfoRequest(request);
|
assertCheckFileInfoRequest(request);
|
||||||
|
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::Load", _phase == Phase::Load);
|
LOK_ASSERT_STATE(_phase, Phase::Load);
|
||||||
TRANSITION_STATE(_phase, Phase::Redirected);
|
TRANSITION_STATE(_phase, Phase::Redirected);
|
||||||
|
|
||||||
http::Response httpResponse(http::StatusCode::Found);
|
http::Response httpResponse(http::StatusCode::Found);
|
||||||
|
@ -99,7 +99,7 @@ public:
|
||||||
|
|
||||||
assertGetFileRequest(request);
|
assertGetFileRequest(request);
|
||||||
|
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::GetFile", _phase == Phase::GetFile);
|
LOK_ASSERT_STATE(_phase, Phase::GetFile);
|
||||||
TRANSITION_STATE(_phase, Phase::Redirected2);
|
TRANSITION_STATE(_phase, Phase::Redirected2);
|
||||||
|
|
||||||
http::Response httpResponse(http::StatusCode::Found);
|
http::Response httpResponse(http::StatusCode::Found);
|
||||||
|
@ -115,7 +115,7 @@ public:
|
||||||
|
|
||||||
assertGetFileRequest(request);
|
assertGetFileRequest(request);
|
||||||
|
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::Redirected2", _phase == Phase::Redirected2);
|
LOK_ASSERT_STATE(_phase, Phase::Redirected2);
|
||||||
TRANSITION_STATE(_phase, Phase::Done);
|
TRANSITION_STATE(_phase, Phase::Done);
|
||||||
|
|
||||||
http::Response httpResponse(http::StatusCode::OK);
|
http::Response httpResponse(http::StatusCode::OK);
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
assertPutFileRequest(const Poco::Net::HTTPRequest& request) override
|
assertPutFileRequest(const Poco::Net::HTTPRequest& request) override
|
||||||
{
|
{
|
||||||
LOG_TST("PutFile");
|
LOG_TST("PutFile");
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::WaitPutFile", _phase == Phase::WaitPutFile);
|
LOK_ASSERT_STATE(_phase, Phase::WaitPutFile);
|
||||||
|
|
||||||
// Triggered while closing.
|
// Triggered while closing.
|
||||||
LOK_ASSERT_EQUAL(std::string("false"), request.get("X-COOL-WOPI-IsAutosave"));
|
LOK_ASSERT_EQUAL(std::string("false"), request.get("X-COOL-WOPI-IsAutosave"));
|
||||||
|
@ -83,8 +83,7 @@ public:
|
||||||
bool onDocumentLoaded(const std::string& message) override
|
bool onDocumentLoaded(const std::string& message) override
|
||||||
{
|
{
|
||||||
LOG_TST("Doc (" << toString(_phase) << "): [" << message << ']');
|
LOG_TST("Doc (" << toString(_phase) << "): [" << message << ']');
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::WaitLoadStatus",
|
LOK_ASSERT_STATE(_phase, Phase::WaitLoadStatus);
|
||||||
_phase == Phase::WaitLoadStatus);
|
|
||||||
|
|
||||||
// Modify and wait for the notification.
|
// Modify and wait for the notification.
|
||||||
TRANSITION_STATE(_phase, Phase::WaitModifiedStatus);
|
TRANSITION_STATE(_phase, Phase::WaitModifiedStatus);
|
||||||
|
@ -104,8 +103,7 @@ public:
|
||||||
if (_phase == Phase::WaitModifiedStatus)
|
if (_phase == Phase::WaitModifiedStatus)
|
||||||
{
|
{
|
||||||
LOG_TST("Doc (" << toString(_phase) << "): [" << message << ']');
|
LOG_TST("Doc (" << toString(_phase) << "): [" << message << ']');
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::WaitModifiedStatus",
|
LOK_ASSERT_STATE(_phase, Phase::WaitModifiedStatus);
|
||||||
_phase == Phase::WaitModifiedStatus);
|
|
||||||
|
|
||||||
// Save and immediately modify, then close the connection.
|
// Save and immediately modify, then close the connection.
|
||||||
WSD_CMD("save dontTerminateEdit=0 dontSaveIfUnmodified=0 "
|
WSD_CMD("save dontTerminateEdit=0 dontSaveIfUnmodified=0 "
|
||||||
|
@ -189,7 +187,7 @@ public:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOK_ASSERT_EQUAL(std::string("false"), request.get("X-COOL-WOPI-IsModifiedByUser"));
|
LOK_ASSERT_EQUAL(std::string("false"), request.get("X-COOL-WOPI-IsModifiedByUser"));
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::WaitPutFile", _phase == Phase::Done);
|
LOK_ASSERT_STATE(_phase, Phase::Done);
|
||||||
// LOK_ASSERT_EQUAL_MESSAGE("Expected to be in Phase::WaitPutFile", 2, _uploadCount);
|
// LOK_ASSERT_EQUAL_MESSAGE("Expected to be in Phase::WaitPutFile", 2, _uploadCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,8 +198,7 @@ public:
|
||||||
bool onDocumentLoaded(const std::string& message) override
|
bool onDocumentLoaded(const std::string& message) override
|
||||||
{
|
{
|
||||||
LOG_TST("Doc (" << toString(_phase) << "): [" << message << ']');
|
LOG_TST("Doc (" << toString(_phase) << "): [" << message << ']');
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::WaitLoadStatus",
|
LOK_ASSERT_STATE(_phase, Phase::WaitLoadStatus);
|
||||||
_phase == Phase::WaitLoadStatus);
|
|
||||||
|
|
||||||
// Modify and wait for the notification.
|
// Modify and wait for the notification.
|
||||||
TRANSITION_STATE(_phase, Phase::WaitModifiedStatus);
|
TRANSITION_STATE(_phase, Phase::WaitModifiedStatus);
|
||||||
|
@ -216,8 +213,7 @@ public:
|
||||||
bool onDocumentModified(const std::string& message) override
|
bool onDocumentModified(const std::string& message) override
|
||||||
{
|
{
|
||||||
LOG_TST("Doc (" << toString(_phase) << "): [" << message << ']');
|
LOG_TST("Doc (" << toString(_phase) << "): [" << message << ']');
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::WaitModifiedStatus",
|
LOK_ASSERT_STATE(_phase, Phase::WaitModifiedStatus);
|
||||||
_phase == Phase::WaitModifiedStatus);
|
|
||||||
|
|
||||||
_stopwatch.restart();
|
_stopwatch.restart();
|
||||||
|
|
||||||
|
|
|
@ -272,8 +272,8 @@ public:
|
||||||
// because only in that case there is no user input.
|
// because only in that case there is no user input.
|
||||||
LOK_ASSERT_MESSAGE("Expected reason to be 'Data-loss detected'",
|
LOK_ASSERT_MESSAGE("Expected reason to be 'Data-loss detected'",
|
||||||
reason.starts_with("Data-loss detected"));
|
reason.starts_with("Data-loss detected"));
|
||||||
LOK_ASSERT_MESSAGE("Expected to be in Phase::WaitDocClose but was " + toString(_phase),
|
LOK_ASSERT_STATE(_phase, Phase::WaitDocClose);
|
||||||
_phase == Phase::WaitDocClose);
|
|
||||||
// In SaveOverwrite, we should not be in modified state, because we do save
|
// In SaveOverwrite, we should not be in modified state, because we do save
|
||||||
// and upload. But because we don't wait for the modified=false, we can end-up
|
// and upload. But because we don't wait for the modified=false, we can end-up
|
||||||
// here. Since we will verify after reloading that we have no data-loss, it's OK.
|
// here. Since we will verify after reloading that we have no data-loss, it's OK.
|
||||||
|
|
Loading…
Reference in New Issue