OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Multi-threaded tests of ConditionVariable class. | 5 // Multi-threaded tests of ConditionVariable class. |
6 | 6 |
7 #include <time.h> | 7 #include <time.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 cv.TimedWait(WAIT_TIME + FUDGE_TIME); | 159 cv.TimedWait(WAIT_TIME + FUDGE_TIME); |
160 TimeDelta duration = TimeTicks::Now() - start; | 160 TimeDelta duration = TimeTicks::Now() - start; |
161 // We can't use EXPECT_GE here as the TimeDelta class does not support the | 161 // We can't use EXPECT_GE here as the TimeDelta class does not support the |
162 // required stream conversion. | 162 // required stream conversion. |
163 EXPECT_TRUE(duration >= WAIT_TIME); | 163 EXPECT_TRUE(duration >= WAIT_TIME); |
164 | 164 |
165 lock.Release(); | 165 lock.Release(); |
166 } | 166 } |
167 | 167 |
168 TEST_F(ConditionVariableTest, MultiThreadConsumerTest) { | 168 // This test is flaky due to excessive timing sensitivity. |
| 169 TEST_F(ConditionVariableTest, DISABLED_MultiThreadConsumerTest) { |
169 const int kThreadCount = 10; | 170 const int kThreadCount = 10; |
170 WorkQueue queue(kThreadCount); // Start the threads. | 171 WorkQueue queue(kThreadCount); // Start the threads. |
171 | 172 |
172 Lock private_lock; // Used locally for master to wait. | 173 Lock private_lock; // Used locally for master to wait. |
173 AutoLock private_held_lock(private_lock); | 174 AutoLock private_held_lock(private_lock); |
174 ConditionVariable private_cv(&private_lock); | 175 ConditionVariable private_cv(&private_lock); |
175 | 176 |
176 { | 177 { |
177 AutoLock auto_lock(*queue.lock()); | 178 AutoLock auto_lock(*queue.lock()); |
178 while (!queue.EveryIdWasAllocated()) | 179 while (!queue.EveryIdWasAllocated()) |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 { | 651 { |
651 AutoLock auto_lock(lock_); | 652 AutoLock auto_lock(lock_); |
652 // Send notification that we completed our "work." | 653 // Send notification that we completed our "work." |
653 WorkIsCompleted(thread_id); | 654 WorkIsCompleted(thread_id); |
654 } | 655 } |
655 } | 656 } |
656 } | 657 } |
657 | 658 |
658 } // namespace | 659 } // namespace |
659 | 660 |
OLD | NEW |