mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 16:35:06 +00:00
headless-browser: Log current test when WebContent crashes
This commit is contained in:
parent
82ec1ea75e
commit
c7f7ee2c4b
1 changed files with 11 additions and 0 deletions
|
@ -54,6 +54,8 @@
|
||||||
|
|
||||||
constexpr int DEFAULT_TIMEOUT_MS = 30000; // 30sec
|
constexpr int DEFAULT_TIMEOUT_MS = 30000; // 30sec
|
||||||
|
|
||||||
|
static StringView s_current_test_path;
|
||||||
|
|
||||||
class HeadlessWebContentView final : public WebView::ViewImplementation {
|
class HeadlessWebContentView final : public WebView::ViewImplementation {
|
||||||
public:
|
public:
|
||||||
static ErrorOr<NonnullOwnPtr<HeadlessWebContentView>> create(Core::AnonymousBuffer theme, Gfx::IntSize const& window_size, StringView web_driver_ipc_path, Ladybird::IsLayoutTestMode is_layout_test_mode = Ladybird::IsLayoutTestMode::No)
|
static ErrorOr<NonnullOwnPtr<HeadlessWebContentView>> create(Core::AnonymousBuffer theme, Gfx::IntSize const& window_size, StringView web_driver_ipc_path, Ladybird::IsLayoutTestMode is_layout_test_mode = Ladybird::IsLayoutTestMode::No)
|
||||||
|
@ -80,6 +82,14 @@ public:
|
||||||
if (!web_driver_ipc_path.is_empty())
|
if (!web_driver_ipc_path.is_empty())
|
||||||
view->client().async_connect_to_webdriver(web_driver_ipc_path);
|
view->client().async_connect_to_webdriver(web_driver_ipc_path);
|
||||||
|
|
||||||
|
view->m_client_state.client->on_web_content_process_crash = [] {
|
||||||
|
warnln("\033[31;1mWebContent Crashed!!\033[0m");
|
||||||
|
if (!s_current_test_path.is_empty()) {
|
||||||
|
warnln(" Last started test: {}", s_current_test_path);
|
||||||
|
}
|
||||||
|
VERIFY_NOT_REACHED();
|
||||||
|
};
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,6 +338,7 @@ static ErrorOr<TestResult> run_ref_test(HeadlessWebContentView& view, StringView
|
||||||
|
|
||||||
static ErrorOr<TestResult> run_test(HeadlessWebContentView& view, StringView input_path, StringView expectation_path, TestMode mode, bool dump_failed_ref_tests)
|
static ErrorOr<TestResult> run_test(HeadlessWebContentView& view, StringView input_path, StringView expectation_path, TestMode mode, bool dump_failed_ref_tests)
|
||||||
{
|
{
|
||||||
|
s_current_test_path = input_path;
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case TestMode::Text:
|
case TestMode::Text:
|
||||||
case TestMode::Layout:
|
case TestMode::Layout:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue