2024-10-10 11:56:27 -04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/ByteString.h>
|
|
|
|
#include <AK/Error.h>
|
|
|
|
#include <AK/NonnullOwnPtr.h>
|
|
|
|
#include <AK/Vector.h>
|
2024-11-12 10:36:53 -05:00
|
|
|
#include <LibWeb/PixelUnits.h>
|
2024-10-10 11:56:27 -04:00
|
|
|
#include <LibWebView/Application.h>
|
|
|
|
|
|
|
|
namespace Ladybird {
|
|
|
|
|
|
|
|
class HeadlessWebView;
|
|
|
|
|
|
|
|
class Application : public WebView::Application {
|
|
|
|
WEB_VIEW_APPLICATION(Application)
|
|
|
|
|
|
|
|
public:
|
2024-11-05 16:44:19 -07:00
|
|
|
~Application();
|
|
|
|
|
2024-10-10 11:56:27 -04:00
|
|
|
static Application& the()
|
|
|
|
{
|
|
|
|
return static_cast<Application&>(WebView::Application::the());
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void create_platform_arguments(Core::ArgsParser&) override;
|
2025-03-15 16:56:52 -04:00
|
|
|
virtual void create_platform_options(WebView::BrowserOptions&, WebView::WebContentOptions&) override;
|
2024-10-10 11:56:27 -04:00
|
|
|
|
2024-11-05 16:44:19 -07:00
|
|
|
ErrorOr<void> launch_test_fixtures();
|
2024-10-10 11:56:27 -04:00
|
|
|
|
2024-11-12 10:36:53 -05:00
|
|
|
HeadlessWebView& create_web_view(Core::AnonymousBuffer theme, Web::DevicePixelSize window_size);
|
2025-04-15 15:54:30 -06:00
|
|
|
HeadlessWebView& create_child_web_view(HeadlessWebView&, u64 page_index);
|
2024-10-10 11:56:27 -04:00
|
|
|
void destroy_web_views();
|
|
|
|
|
|
|
|
template<typename Callback>
|
|
|
|
void for_each_web_view(Callback&& callback)
|
|
|
|
{
|
|
|
|
for (auto& web_view : m_web_views)
|
|
|
|
callback(*web_view);
|
|
|
|
}
|
|
|
|
|
2024-11-30 08:51:59 -05:00
|
|
|
static constexpr u8 VERBOSITY_LEVEL_LOG_TEST_DURATION = 1;
|
|
|
|
static constexpr u8 VERBOSITY_LEVEL_LOG_SLOWEST_TESTS = 2;
|
|
|
|
static constexpr u8 VERBOSITY_LEVEL_LOG_SKIPPED_TESTS = 3;
|
|
|
|
|
2024-10-10 11:56:27 -04:00
|
|
|
int screenshot_timeout { 1 };
|
2025-05-20 07:19:29 -04:00
|
|
|
ByteString screenshot_path { "output.png"sv };
|
2024-10-10 11:56:27 -04:00
|
|
|
ByteString resources_folder;
|
|
|
|
bool dump_failed_ref_tests { false };
|
|
|
|
bool dump_layout_tree { false };
|
|
|
|
bool dump_text { false };
|
|
|
|
bool dump_gc_graph { false };
|
|
|
|
bool is_layout_test_mode { false };
|
|
|
|
size_t test_concurrency { 1 };
|
2024-11-05 16:45:43 -07:00
|
|
|
ByteString python_executable_path;
|
2024-10-10 11:56:27 -04:00
|
|
|
ByteString test_root_path;
|
2025-02-04 19:23:11 +00:00
|
|
|
Vector<ByteString> test_globs;
|
2024-10-10 11:56:27 -04:00
|
|
|
bool test_dry_run { false };
|
|
|
|
bool rebaseline { false };
|
2024-11-30 08:51:59 -05:00
|
|
|
u8 verbosity { 0 };
|
2024-10-26 18:22:18 +02:00
|
|
|
int per_test_timeout_in_seconds { 30 };
|
2024-11-13 22:33:12 +04:00
|
|
|
int width { 800 };
|
|
|
|
int height { 600 };
|
2024-10-10 11:56:27 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
Vector<NonnullOwnPtr<HeadlessWebView>> m_web_views;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|