Index: webrtc/base/timeutils_unittest.cc |
diff --git a/webrtc/base/timeutils_unittest.cc b/webrtc/base/timeutils_unittest.cc |
index f183684e6ccf41d3c1e9801ac987da55f7f1426e..fbd27d8ac08164150855b272b3f7c700d2b58cce 100644 |
--- a/webrtc/base/timeutils_unittest.cc |
+++ b/webrtc/base/timeutils_unittest.cc |
@@ -359,24 +359,25 @@ TEST(FakeClock, SettingTimeWakesThreads) { |
message_handler_dispatched.Set(); |
}; |
FunctorMessageHandler<void, decltype(functor)> handler(functor); |
- worker.PostDelayed(10000, &handler); |
+ worker.PostDelayed(60000, &handler); |
// Wait for a bit for the worker thread to be started and enter its socket |
- // select(). |
+ // select(). Otherwise this test would be trivial since the worker thread |
+ // would process the event as soon as it was started. |
Thread::Current()->SleepMs(1000); |
tommi
2016/06/02 07:59:01
A whole second seems like a lot. Can we synchroni
Taylor Brandstetter
2016/06/02 17:19:54
I picked a long time so that it's guaranteed to be
|
// Advance the fake clock, expecting the worker thread to wake up |
- // and dispatch the message quickly. |
- clock.AdvanceTime(TimeDelta::FromSeconds(10u)); |
- message_handler_dispatched.Wait(Event::kForever); |
+ // and dispatch the message instantly. |
+ clock.AdvanceTime(TimeDelta::FromSeconds(60u)); |
+ EXPECT_TRUE(message_handler_dispatched.Wait(0)); |
worker.Stop(); |
SetClock(nullptr); |
- // The message should have been dispatched long before the 10 seconds fully |
- // elapsed. |
+ // The message should have been dispatched long before the 60 seconds fully |
+ // elapsed (just a sanity check). |
int64_t real_end_time_ms = TimeMillis(); |
- EXPECT_LT(real_end_time_ms - real_start_time_ms, 2000); |
+ EXPECT_LT(real_end_time_ms - real_start_time_ms, 10000); |
} |
} // namespace rtc |