From 2c2e3a28851a3b45f918f0d4fa520cfd02cf5ab8 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Tue, 17 Nov 2020 09:53:01 -0800 Subject: [PATCH] re-enable skipandsubmitframe (#22546) --- shell/common/shell_unittests.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index 5add14df767a61..1579af2c1d24c5 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -1001,7 +1001,13 @@ TEST_F(ShellTest, // TODO(https://github.com/flutter/flutter/issues/59816): Enable on fuchsia. // TODO(https://github.com/flutter/flutter/issues/66056): Deflake on all other // platforms -TEST_F(ShellTest, DISABLED_SkipAndSubmitFrame) { +TEST_F(ShellTest, +#if defined(OS_FUCHSIA) + DISABLED_SkipAndSubmitFrame +#else + SkipAndSubmitFrame +#endif +) { auto settings = CreateSettingsForFixture(); fml::AutoResetWaitableEvent end_frame_latch; std::shared_ptr external_view_embedder; @@ -1009,8 +1015,11 @@ TEST_F(ShellTest, DISABLED_SkipAndSubmitFrame) { auto end_frame_callback = [&](bool should_resubmit_frame, fml::RefPtr raster_thread_merger) { - external_view_embedder->UpdatePostPrerollResult( - PostPrerollResult::kSuccess); + if (should_resubmit_frame && !raster_thread_merger->IsMerged()) { + raster_thread_merger->MergeWithLease(10); + external_view_embedder->UpdatePostPrerollResult( + PostPrerollResult::kSuccess); + } end_frame_latch.Signal(); }; external_view_embedder = std::make_shared( @@ -1033,10 +1042,12 @@ TEST_F(ShellTest, DISABLED_SkipAndSubmitFrame) { end_frame_latch.Wait(); ASSERT_EQ(0, external_view_embedder->GetSubmittedFrameCount()); - PumpOneFrame(shell.get()); + // Let the resubmitted frame to run and `GetSubmittedFrameCount` should be + // called. end_frame_latch.Wait(); ASSERT_EQ(1, external_view_embedder->GetSubmittedFrameCount()); + PlatformViewNotifyDestroyed(shell.get()); DestroyShell(std::move(shell)); }