mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Fixes Flaky test by set larger timer(100 ->1000 ms) for CancelableAlarm.
PiperOrigin-RevId: 450911652
This commit is contained in:
committed by
Copybara-Service
parent
8e048f7be0
commit
f39770d690
@@ -70,9 +70,9 @@ TEST(CancelableAlarmTest, CanCreateRecurringAlarm) {
|
||||
AtomicReference<int> count(0);
|
||||
CancelableAlarm alarm(
|
||||
"test_alarm", [&count]() { count.Set(count.Get() + 1); },
|
||||
absl::Milliseconds(100), &alarm_executor, /*is_recurring=*/true);
|
||||
// Wait for 2 rounds (>100ms * 2) and expect the `count` = 2.
|
||||
SystemClock::Sleep(absl::Milliseconds(290));
|
||||
absl::Milliseconds(1000), &alarm_executor, /*is_recurring=*/true);
|
||||
// Wait for 2 rounds (>1000ms * 2) and expect the `count` = 2.
|
||||
SystemClock::Sleep(absl::Milliseconds(2800));
|
||||
alarm.Cancel();
|
||||
EXPECT_EQ(count.Get(), 2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user