diff --git a/UI/Headless/Test.cpp b/UI/Headless/Test.cpp index 94ad1858657..0b43bde7585 100644 --- a/UI/Headless/Test.cpp +++ b/UI/Headless/Test.cpp @@ -147,7 +147,8 @@ void run_dump_test(HeadlessWebView& view, Test& test, URL::URL const& url, int t auto handle_completed_test = [&test, url]() -> ErrorOr { if (test.expectation_path.is_empty()) { - outln("{}", test.text); + 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) {