From b460fd8b1678a7a705148692fba15613a12d9061 Mon Sep 17 00:00:00 2001 From: skvlad Date: Tue, 6 Sep 2016 14:34:32 -0700 Subject: [PATCH] Increase timeout for flaky tests for ProcessThreadImpl These tests were waiting for a thread to start in 100 ms. This seems to be not enough on some Windows bots, as there were multiple failures recently: https://build.chromium.org/p/client.webrtc/builders/Win32%20Debug/builds/9188/steps/modules_unittests/logs/stdio https://build.chromium.org/p/client.webrtc/builders/Win64%20Debug/builds/8794/steps/modules_unittests/logs/stdio I have increased the timeout to 500 ms. This will not make successful test runs slower, but will reduce the chance of a spurious failure. R=perkj@webrtc.org Review URL: https://codereview.webrtc.org/2308183002 . Cr-Commit-Position: refs/heads/master@{#14096} --- .../source/process_thread_impl_unittest.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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(); }