headless-browser: Do not log the inner text of crash tests

This re-implements 533c8e910a without
breaking the ability to dump layout trees.
This commit is contained in:
Timothy Flynn 2025-03-02 11:14:59 -05:00 committed by Tim Flynn
commit cf523137ad
Notes: github-actions[bot] 2025-03-02 16:50:40 +00:00

View file

@ -147,6 +147,7 @@ void run_dump_test(HeadlessWebView& view, Test& test, URL::URL const& url, int t
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;
}
@ -234,7 +235,7 @@ 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) {
// We don't want subframe loads to trigger the test finish.
if (!url.equals(loaded_url, URL::ExcludeFragment::Yes))
@ -261,6 +262,13 @@ void run_dump_test(HeadlessWebView& view, Test& test, URL::URL const& url, int t
if (test.did_finish_loading)
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) {