mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
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
84 lines
1.7 KiB
C++
84 lines
1.7 KiB
C++
/*
|
|
* Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Assertions.h>
|
|
#include <AK/ByteString.h>
|
|
#include <AK/Error.h>
|
|
#include <AK/RefPtr.h>
|
|
#include <AK/String.h>
|
|
#include <AK/StringView.h>
|
|
#include <AK/Time.h>
|
|
#include <LibCore/Forward.h>
|
|
#include <LibCore/Promise.h>
|
|
#include <LibGfx/Forward.h>
|
|
#include <LibGfx/Size.h>
|
|
#include <LibURL/Forward.h>
|
|
|
|
namespace Ladybird {
|
|
|
|
class HeadlessWebView;
|
|
|
|
enum class TestMode {
|
|
Layout,
|
|
Text,
|
|
Ref,
|
|
};
|
|
|
|
enum class TestResult {
|
|
Pass,
|
|
Fail,
|
|
Skipped,
|
|
Timeout,
|
|
};
|
|
|
|
static constexpr StringView test_result_to_string(TestResult result)
|
|
{
|
|
switch (result) {
|
|
case TestResult::Pass:
|
|
return "Pass"sv;
|
|
case TestResult::Fail:
|
|
return "Fail"sv;
|
|
case TestResult::Skipped:
|
|
return "Skipped"sv;
|
|
case TestResult::Timeout:
|
|
return "Timeout"sv;
|
|
}
|
|
VERIFY_NOT_REACHED();
|
|
}
|
|
|
|
struct Test {
|
|
TestMode mode;
|
|
|
|
ByteString input_path {};
|
|
ByteString expectation_path {};
|
|
|
|
UnixDateTime start_time {};
|
|
UnixDateTime end_time {};
|
|
|
|
String text {};
|
|
bool did_finish_test { false };
|
|
bool did_finish_loading { false };
|
|
|
|
RefPtr<Gfx::Bitmap> actual_screenshot {};
|
|
RefPtr<Gfx::Bitmap> expectation_screenshot {};
|
|
};
|
|
|
|
struct TestCompletion {
|
|
Test& test;
|
|
TestResult result;
|
|
};
|
|
|
|
using TestPromise = Core::Promise<TestCompletion>;
|
|
|
|
constexpr inline int DEFAULT_TIMEOUT_MS = 30000; // 30sec
|
|
|
|
ErrorOr<void> run_tests(Core::AnonymousBuffer const& theme, Gfx::IntSize window_size);
|
|
void run_dump_test(HeadlessWebView&, Test&, URL::URL const&, int timeout_in_milliseconds = DEFAULT_TIMEOUT_MS);
|
|
|
|
}
|