Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit e7519c0

Browse files
committed
Fix infinite waiting.
1 parent 3c0ae52 commit e7519c0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

shell/common/shell_unittests.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,15 @@ TEST_F(ShellTest, ReportTimingsIsCalled) {
735735

736736
TEST_F(ShellTest, FrameRasterizedCallbackIsCalled) {
737737
auto settings = CreateSettingsForFixture();
738+
739+
FrameTiming timing;
740+
fml::AutoResetWaitableEvent timingLatch;
741+
settings.frame_rasterized_callback = [&timing,
742+
&timingLatch](const FrameTiming& t) {
743+
timing = t;
744+
timingLatch.Signal();
745+
};
746+
738747
std::unique_ptr<Shell> shell = CreateShell(settings);
739748

740749
// Wait to make |start| bigger than zero
@@ -745,22 +754,13 @@ TEST_F(ShellTest, FrameRasterizedCallbackIsCalled) {
745754
// |DartVMInitializer::Initialize()| within |CreateShell()|.
746755
fml::TimePoint start = fml::TimePoint::Now();
747756

748-
fml::AutoResetWaitableEvent timingLatch;
749-
FrameTiming timing;
750-
751757
for (auto phase : FrameTiming::kPhases) {
752758
timing.Set(phase, fml::TimePoint());
753759
// Check that the time points are initially smaller than start, so
754760
// CheckFrameTimings will fail if they're not properly set later.
755761
ASSERT_TRUE(timing.Get(phase) < start);
756762
}
757763

758-
settings.frame_rasterized_callback = [&timing,
759-
&timingLatch](const FrameTiming& t) {
760-
timing = t;
761-
timingLatch.Signal();
762-
};
763-
764764
// Create the surface needed by rasterizer
765765
PlatformViewNotifyCreated(shell.get());
766766

0 commit comments

Comments
 (0)