2019-05-15 21:14:29 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
|
|
|
/*
|
2023-11-09 12:23:00 -06:00
|
|
|
* Copyright the Collabora Online contributors.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*
|
2019-05-15 21:14:29 -05:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include <WopiTestServer.hpp>
|
|
|
|
#include <Log.hpp>
|
|
|
|
#include <Unit.hpp>
|
|
|
|
#include <UnitHTTP.hpp>
|
|
|
|
#include <helpers.hpp>
|
|
|
|
#include <Poco/Util/LayeredConfiguration.h>
|
|
|
|
|
|
|
|
class UnitWOPILoadEncoded : public WopiTestServer
|
|
|
|
{
|
2022-07-22 18:54:44 -05:00
|
|
|
STATE_ENUM(Phase, LoadEncoded, CloseDoc, Done)
|
|
|
|
_phase;
|
2019-05-15 21:14:29 -05:00
|
|
|
|
|
|
|
public:
|
2020-12-20 21:11:33 -06:00
|
|
|
UnitWOPILoadEncoded()
|
|
|
|
: WopiTestServer("UnitWOPILoadEncoded")
|
|
|
|
, _phase(Phase::LoadEncoded)
|
2019-05-15 21:14:29 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-12-24 11:15:37 -06:00
|
|
|
void invokeWSDTest() override
|
2019-05-15 21:14:29 -05:00
|
|
|
{
|
|
|
|
switch (_phase)
|
|
|
|
{
|
|
|
|
case Phase::LoadEncoded:
|
|
|
|
{
|
2022-07-22 18:54:44 -05:00
|
|
|
TRANSITION_STATE(_phase, Phase::CloseDoc);
|
|
|
|
|
2019-05-15 21:14:29 -05:00
|
|
|
initWebsocket("/wopi/files/3?access_token=anything");
|
|
|
|
|
2022-07-22 18:54:44 -05:00
|
|
|
WSD_CMD("load url=" + getWopiSrc());
|
2019-05-15 21:14:29 -05:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Phase::CloseDoc:
|
|
|
|
{
|
2022-07-22 18:54:44 -05:00
|
|
|
TRANSITION_STATE(_phase, Phase::Done);
|
|
|
|
|
|
|
|
WSD_CMD("closedocument");
|
2019-05-15 21:14:29 -05:00
|
|
|
break;
|
|
|
|
}
|
2022-07-22 18:54:44 -05:00
|
|
|
case Phase::Done:
|
2019-05-15 21:14:29 -05:00
|
|
|
{
|
|
|
|
exitTest(TestResult::Ok);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
UnitBase *unit_create_wsd(void)
|
|
|
|
{
|
|
|
|
return new UnitWOPILoadEncoded();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|