diff --git a/webrtc/modules/utility/source/process_thread_impl_unittest.cc b/webrtc/modules/utility/source/process_thread_impl_unittest.cc index 1fe3a417f8..ec3b5a1909 100644 --- a/webrtc/modules/utility/source/process_thread_impl_unittest.cc +++ b/webrtc/modules/utility/source/process_thread_impl_unittest.cc @@ -27,6 +27,11 @@ using ::testing::Invoke; using ::testing::Return; using ::testing::SetArgPointee; +// The length of time, in milliseconds, to wait for an event to become signaled. +// Set to a fairly large value as there is quite a bit of variation on some +// Windows bots. +static const int kEventWaitTimeout = 500; + class MockModule : public Module { public: MOCK_METHOD0(TimeUntilNextProcess, int64_t()); @@ -87,7 +92,7 @@ TEST(ProcessThreadImpl, ProcessCall) { EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1); thread.RegisterModule(&module); - EXPECT_EQ(kEventSignaled, event->Wait(100)); + EXPECT_EQ(kEventSignaled, event->Wait(kEventWaitTimeout)); EXPECT_CALL(module, ProcessThreadAttached(nullptr)).Times(1); thread.Stop(); @@ -109,7 +114,7 @@ TEST(ProcessThreadImpl, ProcessCall2) { EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1); thread.Start(); - EXPECT_EQ(kEventSignaled, event->Wait(100)); + EXPECT_EQ(kEventSignaled, event->Wait(kEventWaitTimeout)); EXPECT_CALL(module, ProcessThreadAttached(nullptr)).Times(1); thread.Stop(); @@ -135,7 +140,7 @@ TEST(ProcessThreadImpl, Deregister) { EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1); thread.Start(); - EXPECT_EQ(kEventSignaled, event->Wait(100)); + EXPECT_EQ(kEventSignaled, event->Wait(kEventWaitTimeout)); EXPECT_CALL(module, ProcessThreadAttached(nullptr)).Times(1); thread.DeRegisterModule(&module); @@ -281,9 +286,9 @@ TEST(ProcessThreadImpl, WakeUp) { EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1); thread.RegisterModule(&module); - EXPECT_EQ(kEventSignaled, started->Wait(100)); + EXPECT_EQ(kEventSignaled, started->Wait(kEventWaitTimeout)); thread.WakeUp(&module); - EXPECT_EQ(kEventSignaled, called->Wait(100)); + EXPECT_EQ(kEventSignaled, called->Wait(kEventWaitTimeout)); EXPECT_CALL(module, ProcessThreadAttached(nullptr)).Times(1); thread.Stop(); @@ -302,7 +307,7 @@ TEST(ProcessThreadImpl, PostTask) { std::unique_ptr task(new RaiseEventTask(task_ran.get())); thread.Start(); thread.PostTask(std::move(task)); - EXPECT_EQ(kEventSignaled, task_ran->Wait(100)); + EXPECT_EQ(kEventSignaled, task_ran->Wait(kEventWaitTimeout)); thread.Stop(); }