Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Unified Diff: base/synchronization/condition_variable_unittest.cc

Issue 2047433004: content: Add heartbeat trace for CategorizedWorkerPool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/synchronization/condition_variable_posix.cc ('k') | base/synchronization/condition_variable_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « base/synchronization/condition_variable_posix.cc ('k') | base/synchronization/condition_variable_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698