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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 cv.TimedWait(WAIT_TIME + FUDGE_TIME); | 177 cv.TimedWait(WAIT_TIME + FUDGE_TIME); |
178 TimeDelta duration = TimeTicks::Now() - start; | 178 TimeDelta duration = TimeTicks::Now() - start; |
179 // We can't use EXPECT_GE here as the TimeDelta class does not support the | 179 // We can't use EXPECT_GE here as the TimeDelta class does not support the |
180 // required stream conversion. | 180 // required stream conversion. |
181 EXPECT_TRUE(duration >= WAIT_TIME); | 181 EXPECT_TRUE(duration >= WAIT_TIME); |
182 | 182 |
183 lock.Release(); | 183 lock.Release(); |
184 } | 184 } |
185 | 185 |
186 // Test serial task servicing, as well as two parallel task servicing methods. | 186 // Test serial task servicing, as well as two parallel task servicing methods. |
187 // TODO(maruel): http://crbug.com/10607 | 187 // TODO(maruel): This test is flaky, see http://crbug.com/10607 |
188 TEST_F(ConditionVariableTest, DISABLED_MultiThreadConsumerTest) { | 188 TEST_F(ConditionVariableTest, FLAKY_MultiThreadConsumerTest) { |
189 const int kThreadCount = 10; | 189 const int kThreadCount = 10; |
190 WorkQueue queue(kThreadCount); // Start the threads. | 190 WorkQueue queue(kThreadCount); // Start the threads. |
191 | 191 |
192 const int kTaskCount = 10; // Number of tasks in each mini-test here. | 192 const int kTaskCount = 10; // Number of tasks in each mini-test here. |
193 | 193 |
194 base::Time start_time; // Used to time task processing. | 194 base::Time start_time; // Used to time task processing. |
195 | 195 |
196 { | 196 { |
197 AutoLock auto_lock(*queue.lock()); | 197 AutoLock auto_lock(*queue.lock()); |
198 while (!queue.EveryIdWasAllocated()) | 198 while (!queue.EveryIdWasAllocated()) |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 | 730 |
731 { | 731 { |
732 AutoLock auto_lock(lock_); | 732 AutoLock auto_lock(lock_); |
733 // Send notification that we completed our "work." | 733 // Send notification that we completed our "work." |
734 WorkIsCompleted(thread_id); | 734 WorkIsCompleted(thread_id); |
735 } | 735 } |
736 } | 736 } |
737 } | 737 } |
738 | 738 |
739 } // namespace | 739 } // namespace |
OLD | NEW |