OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 cv.TimedWait(WAIT_TIME + FUDGE_TIME); | 182 cv.TimedWait(WAIT_TIME + FUDGE_TIME); |
183 TimeDelta duration = TimeTicks::Now() - start; | 183 TimeDelta duration = TimeTicks::Now() - start; |
184 // We can't use EXPECT_GE here as the TimeDelta class does not support the | 184 // We can't use EXPECT_GE here as the TimeDelta class does not support the |
185 // required stream conversion. | 185 // required stream conversion. |
186 EXPECT_TRUE(duration >= WAIT_TIME); | 186 EXPECT_TRUE(duration >= WAIT_TIME); |
187 | 187 |
188 lock.Release(); | 188 lock.Release(); |
189 } | 189 } |
190 | 190 |
| 191 |
| 192 // Suddenly got flaky on Win, see http://crbug.com/10607 (starting at |
| 193 // comment #15) |
| 194 #if defined(OS_WIN) |
| 195 #define MAYBE_MultiThreadConsumerTest DISABLED_MultiThreadConsumerTest |
| 196 #else |
| 197 #define MAYBE_MultiThreadConsumerTest MultiThreadConsumerTest |
| 198 #endif |
191 // Test serial task servicing, as well as two parallel task servicing methods. | 199 // Test serial task servicing, as well as two parallel task servicing methods. |
192 TEST_F(ConditionVariableTest, MultiThreadConsumerTest) { | 200 TEST_F(ConditionVariableTest, MAYBE_MultiThreadConsumerTest) { |
193 const int kThreadCount = 10; | 201 const int kThreadCount = 10; |
194 WorkQueue queue(kThreadCount); // Start the threads. | 202 WorkQueue queue(kThreadCount); // Start the threads. |
195 | 203 |
196 const int kTaskCount = 10; // Number of tasks in each mini-test here. | 204 const int kTaskCount = 10; // Number of tasks in each mini-test here. |
197 | 205 |
198 Time start_time; // Used to time task processing. | 206 Time start_time; // Used to time task processing. |
199 | 207 |
200 { | 208 { |
201 base::AutoLock auto_lock(*queue.lock()); | 209 base::AutoLock auto_lock(*queue.lock()); |
202 while (!queue.EveryIdWasAllocated()) | 210 while (!queue.EveryIdWasAllocated()) |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 base::AutoLock auto_lock(lock_); | 706 base::AutoLock auto_lock(lock_); |
699 // Send notification that we completed our "work." | 707 // Send notification that we completed our "work." |
700 WorkIsCompleted(thread_id); | 708 WorkIsCompleted(thread_id); |
701 } | 709 } |
702 } | 710 } |
703 } | 711 } |
704 | 712 |
705 } // namespace | 713 } // namespace |
706 | 714 |
707 } // namespace base | 715 } // namespace base |
OLD | NEW |