1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

LibWeb: Add --layout-test-mode flag to HeadlessBrowser

The `layout-test-mode` flag changes the font to be SerenitySans as this
is the font used for layout tests for cross-platform compatibility of
tests.
This commit is contained in:
martinfalisse 2023-05-06 12:46:14 +02:00 committed by Andreas Kling
parent af26b76e0a
commit c719a542c5
6 changed files with 27 additions and 8 deletions

View file

@ -126,7 +126,7 @@ void ViewImplementation::run_javascript(StringView js_source)
#if !defined(AK_OS_SERENITY)
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> ViewImplementation::launch_web_content_process(ReadonlySpan<String> candidate_web_content_paths, EnableCallgrindProfiling enable_callgrind_profiling)
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> ViewImplementation::launch_web_content_process(ReadonlySpan<String> candidate_web_content_paths, EnableCallgrindProfiling enable_callgrind_profiling, IsLayoutTestMode is_layout_test_mode)
{
int socket_fds[2] {};
TRY(Core::System::socketpair(AF_LOCAL, SOCK_STREAM, 0, socket_fds));
@ -162,6 +162,8 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> ViewImplementation::launch_web
};
if (enable_callgrind_profiling == EnableCallgrindProfiling::No)
arguments.remove(0, callgrind_prefix_length);
if (is_layout_test_mode == IsLayoutTestMode::Yes)
arguments.append("--layout-test-mode"sv);
result = Core::System::exec(arguments[0], arguments.span(), Core::System::SearchInPath::Yes);
if (!result.is_error())