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}
This commit is contained in:
skvlad 2016-09-06 14:34:32 -07:00
parent cfaca03b4b
commit b460fd8b16

View File

@ -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<RaiseEventTask> 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();
}