From c166b4abc971fc11ffc16620fc063dc29f87f619 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 11 Nov 2024 14:40:42 -0500 Subject: [PATCH] tests: Fix flaky FrameHandlerTest.Order* tests (fixes #3817) The OnFrameAttached callback relies on a round-trip to the renderer process and may not be synchronized with OnLoadStart/ OnLoadEnd/OnMainFrameChanged callbacks. --- tests/ceftests/frame_handler_unittest.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/ceftests/frame_handler_unittest.cc b/tests/ceftests/frame_handler_unittest.cc index d83e37646..f4b4dbc50 100644 --- a/tests/ceftests/frame_handler_unittest.cc +++ b/tests/ceftests/frame_handler_unittest.cc @@ -392,10 +392,22 @@ struct FrameStatus { for (int i = 0; i <= CALLBACK_LAST; ++i) { if (i < current_callback && IsExpectedCallback(i)) { + if (i == FRAME_ATTACHED && + (current_callback == MAIN_FRAME_CHANGED_ASSIGNED || + current_callback == LOAD_START || current_callback == LOAD_END)) { + // Timing of OnFrameAttached is flaky. See issue #3817. + continue; + } EXPECT_TRUE(got_callback_[i]) << "inside " << func << " should already have gotten " << GetCallbackName(i); } else { + if (current_callback == FRAME_ATTACHED && + (i == MAIN_FRAME_CHANGED_ASSIGNED || i == LOAD_START || + i == LOAD_END)) { + // Timing of OnFrameAttached is flaky. See issue #3817. + continue; + } EXPECT_FALSE(got_callback_[i]) << "inside " << func << " should not already have gotten " << GetCallbackName(i);