test-web: Wait longer before completing crash tests

Previously, a lot of imported WPT crash tests wouldn't wait long
enough for a crash to occur.
This commit is contained in:
Tim Ledbetter 2025-07-14 12:35:11 +01:00 committed by Tim Flynn
commit e1f0284fba
Notes: github-actions[bot] 2025-07-14 17:06:40 +00:00

View file

@ -285,11 +285,30 @@ static void run_dump_test(TestWebView& view, Test& test, URL::URL const& url, in
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) {
view.on_load_finish = [on_test_complete, url, &view, &test](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();
test.did_finish_loading = true;
static String wait_for_crash_test_completion = R"(
document.fonts.ready.then(() => {
requestAnimationFrame(function() {
requestAnimationFrame(function() {
internals.signalTestIsDone("PASS");
});
});
});
)"_string;
view.run_javascript(wait_for_crash_test_completion);
if (test.did_finish_test)
on_test_complete();
};
view.on_test_finish = [&test, on_test_complete](auto const&) {
test.did_finish_test = true;
if (test.did_finish_loading)
on_test_complete();
};
}