libreoffice-online/test/UnitTimeout.cpp
Ashod Nakashian db50626aff wsd: test: refactor BaseUnit self-test
The BaseUnit test didn't belong to UnitTimeout
and, more important, it needed access to
private members to both validate their state
and to reset them (since the test is artificially
initializing both WSD and Kit tests and cannot
uninitialize them, lest we unload ourselves).

As such, the self-test is now internal to
BaseUnit, with the added bonus that it
is called on all tests and not just UnitTimeout.

Also, more assertions have been added.

Change-Id: Ieaf60594f39e978a7250407262bd8bbc9b642c43
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-23 11:07:55 -04:00

34 lines
823 B
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* 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 <chrono>
#include <cassert>
#include <sysexits.h>
#include <Log.hpp>
#include <Util.hpp>
#include <Unit.hpp>
#include "lokassert.hpp"
class UnitTimeout : public UnitWSD
{
public:
UnitTimeout()
: UnitWSD("UnitTimeout")
{
setTimeout(std::chrono::seconds(1));
}
virtual void timeout() override { passTest("Timed out as expected"); }
};
UnitBase* unit_create_wsd(void) { return new UnitTimeout(); }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */