mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
Revert "headless-browser: Do not log the inner text of crash tests"
This reverts commit 533c8e910a
.
This broke the ability to dump layout trees using headless-browser.
This commit is contained in:
parent
53cdb04ee8
commit
1aa009b0cf
Notes:
github-actions[bot]
2025-03-02 16:50:45 +00:00
Author: https://github.com/trflynn89
Commit: 1aa009b0cf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3769
1 changed files with 14 additions and 11 deletions
|
@ -146,8 +146,10 @@ 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.mode == TestMode::Crash)
|
if (test.expectation_path.is_empty()) {
|
||||||
|
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);
|
||||||
|
@ -232,16 +234,24 @@ void run_dump_test(HeadlessWebView& view, Test& test, URL::URL const& url, int t
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
} else if (test.mode == TestMode::Text) {
|
} else if (test.mode == TestMode::Text || test.mode == TestMode::Crash) {
|
||||||
view.on_load_finish = [&test, on_test_complete, url](auto const& loaded_url) {
|
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.
|
// 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.did_finish_test)
|
if (test.expectation_path.is_empty()) {
|
||||||
|
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) {
|
||||||
|
@ -251,13 +261,6 @@ 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) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue