| Index: webrtc/base/timeutils_unittest.cc
|
| diff --git a/webrtc/base/timeutils_unittest.cc b/webrtc/base/timeutils_unittest.cc
|
| index d1cfe23821b4065674331169e94e9a4c289b618e..f183684e6ccf41d3c1e9801ac987da55f7f1426e 100644
|
| --- a/webrtc/base/timeutils_unittest.cc
|
| +++ b/webrtc/base/timeutils_unittest.cc
|
| @@ -301,7 +301,7 @@
|
| // fake clock when it's set.
|
| TEST(FakeClock, TimeFunctionsUseFakeClock) {
|
| FakeClock clock;
|
| - SetClockForTesting(&clock);
|
| + SetClock(&clock);
|
|
|
| clock.SetTimeNanos(987654321u);
|
| EXPECT_EQ(987u, Time32());
|
| @@ -310,7 +310,7 @@
|
| EXPECT_EQ(987654321u, TimeNanos());
|
| EXPECT_EQ(1000u, TimeAfter(13));
|
|
|
| - SetClockForTesting(nullptr);
|
| + SetClock(nullptr);
|
| // After it's unset, we should get a normal time.
|
| EXPECT_NE(987, TimeMillis());
|
| }
|
| @@ -348,7 +348,7 @@
|
| int64_t real_start_time_ms = TimeMillis();
|
|
|
| FakeClock clock;
|
| - SetClockForTesting(&clock);
|
| + SetClock(&clock);
|
|
|
| Thread worker;
|
| worker.Start();
|
| @@ -359,25 +359,24 @@
|
| message_handler_dispatched.Set();
|
| };
|
| FunctorMessageHandler<void, decltype(functor)> handler(functor);
|
| - worker.PostDelayed(60000, &handler);
|
| + worker.PostDelayed(10000, &handler);
|
|
|
| // Wait for a bit for the worker thread to be started and enter its socket
|
| - // select(). Otherwise this test would be trivial since the worker thread
|
| - // would process the event as soon as it was started.
|
| + // select().
|
| Thread::Current()->SleepMs(1000);
|
|
|
| // Advance the fake clock, expecting the worker thread to wake up
|
| - // and dispatch the message instantly.
|
| - clock.AdvanceTime(TimeDelta::FromSeconds(60u));
|
| - EXPECT_TRUE(message_handler_dispatched.Wait(0));
|
| + // and dispatch the message quickly.
|
| + clock.AdvanceTime(TimeDelta::FromSeconds(10u));
|
| + message_handler_dispatched.Wait(Event::kForever);
|
| worker.Stop();
|
|
|
| - SetClockForTesting(nullptr);
|
| -
|
| - // The message should have been dispatched long before the 60 seconds fully
|
| - // elapsed (just a sanity check).
|
| + SetClock(nullptr);
|
| +
|
| + // The message should have been dispatched long before the 10 seconds fully
|
| + // elapsed.
|
| int64_t real_end_time_ms = TimeMillis();
|
| - EXPECT_LT(real_end_time_ms - real_start_time_ms, 10000);
|
| + EXPECT_LT(real_end_time_ms - real_start_time_ms, 2000);
|
| }
|
|
|
| } // namespace rtc
|
|
|