mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
headless-browser: Do not log the inner text of crash tests
This information is not particularly interesting, and it can be quite verbose (such as style-propagation-for-long-continuation-chain.html, which would log hundreds of lines of "a"s and "b"s).
This commit is contained in:
parent
e90d2a5713
commit
533c8e910a
Notes:
github-actions[bot]
2025-02-24 13:08:25 +00:00
Author: https://github.com/trflynn89
Commit: 533c8e910a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3680
1 changed files with 12 additions and 17 deletions
|
@ -146,10 +146,8 @@ void run_dump_test(HeadlessWebView& view, Test& test, URL::URL const& url, int t
|
||||||
});
|
});
|
||||||
|
|
||||||
auto handle_completed_test = [&test, url]() -> ErrorOr<TestResult> {
|
auto handle_completed_test = [&test, url]() -> ErrorOr<TestResult> {
|
||||||
if (test.expectation_path.is_empty()) {
|
if (test.mode == TestMode::Crash)
|
||||||
outln("{}", test.text);
|
|
||||||
return TestResult::Pass;
|
return TestResult::Pass;
|
||||||
}
|
|
||||||
|
|
||||||
auto open_expectation_file = [&](auto mode) {
|
auto open_expectation_file = [&](auto mode) {
|
||||||
auto expectation_file_or_error = Core::File::open(test.expectation_path, mode);
|
auto expectation_file_or_error = Core::File::open(test.expectation_path, mode);
|
||||||
|
@ -234,24 +232,16 @@ void run_dump_test(HeadlessWebView& view, Test& test, URL::URL const& url, int t
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
} else if (test.mode == TestMode::Text || test.mode == TestMode::Crash) {
|
} else if (test.mode == TestMode::Text) {
|
||||||
view.on_load_finish = [&view, &test, on_test_complete, url](auto const& loaded_url) {
|
view.on_load_finish = [&test, on_test_complete, url](auto const& loaded_url) {
|
||||||
// We don't want subframe loads to trigger the test finish.
|
// We don't want subframe loads to trigger the test finish.
|
||||||
if (!url.equals(loaded_url, URL::ExcludeFragment::Yes))
|
if (!url.equals(loaded_url, URL::ExcludeFragment::Yes))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
test.did_finish_loading = true;
|
test.did_finish_loading = true;
|
||||||
|
|
||||||
if (test.expectation_path.is_empty()) {
|
if (test.did_finish_test)
|
||||||
auto promise = view.request_internal_page_info(WebView::PageInfoType::Text);
|
|
||||||
|
|
||||||
promise->when_resolved([&test, on_test_complete = move(on_test_complete)](auto const& text) {
|
|
||||||
test.text = text;
|
|
||||||
on_test_complete();
|
|
||||||
});
|
|
||||||
} else if (test.did_finish_test) {
|
|
||||||
on_test_complete();
|
on_test_complete();
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
view.on_text_test_finish = [&test, on_test_complete](auto const& text) {
|
view.on_text_test_finish = [&test, on_test_complete](auto const& text) {
|
||||||
|
@ -261,6 +251,13 @@ void run_dump_test(HeadlessWebView& view, Test& test, URL::URL const& url, int t
|
||||||
if (test.did_finish_loading)
|
if (test.did_finish_loading)
|
||||||
on_test_complete();
|
on_test_complete();
|
||||||
};
|
};
|
||||||
|
} else if (test.mode == TestMode::Crash) {
|
||||||
|
view.on_load_finish = [on_test_complete = move(on_test_complete), url](auto const& loaded_url) {
|
||||||
|
// We don't want subframe loads to trigger the test finish.
|
||||||
|
if (!url.equals(loaded_url, URL::ExcludeFragment::Yes))
|
||||||
|
return;
|
||||||
|
on_test_complete();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
view.on_set_test_timeout = [timer, timeout_in_milliseconds](double milliseconds) {
|
view.on_set_test_timeout = [timer, timeout_in_milliseconds](double milliseconds) {
|
||||||
|
@ -396,6 +393,7 @@ static void run_test(HeadlessWebView& view, Test& test, Application& app)
|
||||||
auto url = URL::create_with_file_scheme(MUST(FileSystem::real_path(test.input_path)));
|
auto url = URL::create_with_file_scheme(MUST(FileSystem::real_path(test.input_path)));
|
||||||
|
|
||||||
switch (test.mode) {
|
switch (test.mode) {
|
||||||
|
case TestMode::Crash:
|
||||||
case TestMode::Text:
|
case TestMode::Text:
|
||||||
case TestMode::Layout:
|
case TestMode::Layout:
|
||||||
run_dump_test(view, test, url, app.per_test_timeout_in_seconds * 1000);
|
run_dump_test(view, test, url, app.per_test_timeout_in_seconds * 1000);
|
||||||
|
@ -403,9 +401,6 @@ static void run_test(HeadlessWebView& view, Test& test, Application& app)
|
||||||
case TestMode::Ref:
|
case TestMode::Ref:
|
||||||
run_ref_test(view, test, url, app.per_test_timeout_in_seconds * 1000);
|
run_ref_test(view, test, url, app.per_test_timeout_in_seconds * 1000);
|
||||||
return;
|
return;
|
||||||
case TestMode::Crash:
|
|
||||||
run_dump_test(view, test, url, app.per_test_timeout_in_seconds * 1000);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue