ladybird/Ladybird/Headless/Application.h
Timothy Flynn 7bb9d0131c headless-browser: Add a flag to log the slowest 10 LibWeb tests
Useful for finding tests that take a long time to execute.

As of this commit, on macOS, we have:

Text/input/cookie.html: 1228ms
Text/input/css/transition-basics.html: 1060ms
Text/input/HTML/DedicatedWorkerGlobalScope-instanceof.html: 182ms
Text/input/WebAnimations/misc/animation-events-basic.html: 148ms
Text/input/Crypto/SubtleCrypto-deriveBits.html: 130ms
Text/input/IntersectionObserver/observe-box-inside-container-with-scrollable-overflow.html: 117ms
Text/input/navigation/attempt-navigating-object-without-a-document.html: 109ms
Text/input/css/getComputedStyle-print-all.html: 71ms
Text/input/WebAnimations/misc/animation-single-iteration-no-repeat.html: 61ms
Text/input/WebAnimations/animation-methods/updatePlaybackRate.html: 55ms

And on Linux:

Text/input/cookie.html: 1326ms
Text/input/css/transition-basics.html: 1155ms
Screenshot/text-shadow.html: 772ms
Screenshot/css-background-repeat.html: 622ms
Screenshot/object-fit-position.html: 541ms
Screenshot/css-background-position.html: 456ms
Screenshot/css-gradients.html: 451ms
Screenshot/border-radius.html: 400ms
Screenshot/svg-radialGradient.html: 398ms
Text/input/css/getComputedStyle-print-all.html: 325ms
2024-10-14 08:25:41 +02:00

71 lines
1.9 KiB
C++

/*
* 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/RefPtr.h>
#include <AK/Vector.h>
#include <LibGfx/Size.h>
#include <LibImageDecoderClient/Client.h>
#include <LibRequests/RequestClient.h>
#include <LibWebView/Application.h>
namespace Ladybird {
class HeadlessWebView;
class Application : public WebView::Application {
WEB_VIEW_APPLICATION(Application)
public:
static Application& the()
{
return static_cast<Application&>(WebView::Application::the());
}
virtual void create_platform_arguments(Core::ArgsParser&) override;
virtual void create_platform_options(WebView::ChromeOptions&, WebView::WebContentOptions&) override;
ErrorOr<void> launch_services();
static Requests::RequestClient& request_client() { return *the().m_request_client; }
static ImageDecoderClient::Client& image_decoder_client() { return *the().m_image_decoder_client; }
ErrorOr<HeadlessWebView*> create_web_view(Core::AnonymousBuffer theme, Gfx::IntSize window_size);
void destroy_web_views();
template<typename Callback>
void for_each_web_view(Callback&& callback)
{
for (auto& web_view : m_web_views)
callback(*web_view);
}
int screenshot_timeout { 1 };
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 };
ByteString test_root_path;
ByteString test_glob;
bool test_dry_run { false };
bool rebaseline { false };
bool log_slowest_tests { false };
private:
RefPtr<Requests::RequestClient> m_request_client;
RefPtr<ImageDecoderClient::Client> m_image_decoder_client;
Vector<NonnullOwnPtr<HeadlessWebView>> m_web_views;
};
}