Index: base/synchronization/condition_variable_unittest.cc |
diff --git a/base/synchronization/condition_variable_unittest.cc b/base/synchronization/condition_variable_unittest.cc |
index d60b2b8af58aa55c48886933c7682fb452d9f963..adb1c9e67e78b0273ab9fc2a677c4a8353b79608 100644 |
--- a/base/synchronization/condition_variable_unittest.cc |
+++ b/base/synchronization/condition_variable_unittest.cc |
@@ -194,6 +194,28 @@ TEST_F(ConditionVariableTest, TimeoutTest) { |
lock.Release(); |
} |
+void SignalConditionVariable(ConditionVariable* cv) { |
+ cv->Signal(); |
+} |
+ |
+TEST_F(ConditionVariableTest, TimedWaitTimeoutTest) { |
+ Lock lock; |
+ ConditionVariable cv(&lock); |
+ lock.Acquire(); |
+ |
+ bool timed_out = cv.TimedWait(TimeDelta::FromMilliseconds(50)); |
+ EXPECT_TRUE(timed_out); |
+ |
+ Thread thread("Helper"); |
+ thread.Start(); |
+ thread.task_runner()->PostTask(FROM_HERE, |
+ base::Bind(&SignalConditionVariable, &cv)); |
+ timed_out = cv.TimedWait(TimeDelta::FromMilliseconds(300)); |
+ EXPECT_FALSE(timed_out); |
+ |
+ lock.Release(); |
+} |
+ |
#if defined(OS_POSIX) |
const int kDiscontinuitySeconds = 2; |