wsd: test: better UnitOAuth

There was a race between the closedocument
command and the save command that caused
occassional random failures.

Change-Id: I9e0e71545bab586826273fdb6e160b624be91dbe
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This commit is contained in:
Ashod Nakashian 2023-01-25 20:04:39 -05:00 committed by Henry Castro
parent 57fe2061eb
commit 63ac54a552

View file

@ -102,8 +102,6 @@ public:
LOK_ASSERT_EQUAL_MESSAGE("GetFile was not invoked", true, _getFileCalled);
_getFileCalled = false;
// Close the document after loading.
WSD_CMD("closedocument");
switch (_phase)
{
case Phase::LoadToken:
@ -111,16 +109,25 @@ public:
_credential = "abcdefg123456_newtoken";
WSD_CMD("resetaccesstoken " + _credential);
WSD_CMD("save dontTerminateEdit=0 dontSaveIfUnmodified=0");
// Close the document after loading.
WSD_CMD("closedocument");
break;
case Phase::ModifyAccessToken:
// Close the document after loading.
WSD_CMD("closedocument");
break;
case Phase::LoadHeader:
// Close the document after loading.
WSD_CMD("closedocument");
TRANSITION_STATE(_phase, Phase::LoadingHeader);
_credential = "basic==";
initWebsocket("/wopi/files/1?access_header=Authorization: Basic " + _credential);
WSD_CMD("load url=" + getWopiSrc());
break;
case Phase::LoadingHeader:
// Close the document after loading.
WSD_CMD("closedocument");
passTest("Finished all cases successfully");
break;
default: