ladybird/Tests/LibWeb/test-web/Fixture.h
Timothy Flynn 9a5b31ccd1 LibWebView+Tests+UI: Migrate headless-browser to test-web
Now that headless mode is built into the main Ladybird executable, the
headless-browser's only purpose is to run tests. So let's move it to the
testing directory and rename it to test-web (a la test-js / test-wasm).
2025-06-10 12:04:59 -04:00

41 lines
806 B
C++

/*
* Copyright (c) 2024, Andrew Kaster <andrew@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Error.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/Optional.h>
#include <AK/StringView.h>
#include <AK/Vector.h>
#include <LibWebView/Forward.h>
namespace TestWeb {
class Fixture {
public:
virtual ~Fixture();
virtual ErrorOr<void> setup(WebView::WebContentOptions&) = 0;
void teardown()
{
if (is_running())
teardown_impl();
}
virtual StringView name() const = 0;
virtual bool is_running() const { return false; }
static void initialize_fixtures();
static Optional<Fixture&> lookup(StringView name);
static Vector<NonnullOwnPtr<Fixture>>& all();
protected:
virtual void teardown_impl() = 0;
};
}