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 #include "base/threading/worker_pool.h" | 5 #include "base/threading/worker_pool.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 #endif | 91 #endif |
92 | 92 |
93 TEST_F(WorkerPoolTest, MAYBE_PostTaskAndReply) { | 93 TEST_F(WorkerPoolTest, MAYBE_PostTaskAndReply) { |
94 MessageLoop message_loop; | 94 MessageLoop message_loop; |
95 scoped_refptr<PostTaskAndReplyTester> tester(new PostTaskAndReplyTester()); | 95 scoped_refptr<PostTaskAndReplyTester> tester(new PostTaskAndReplyTester()); |
96 tester->RunTest(); | 96 tester->RunTest(); |
97 | 97 |
98 const TimeDelta kMaxDuration = TestTimeouts::tiny_timeout(); | 98 const TimeDelta kMaxDuration = TestTimeouts::tiny_timeout(); |
99 TimeTicks start = TimeTicks::Now(); | 99 TimeTicks start = TimeTicks::Now(); |
100 while (!tester->finished() && TimeTicks::Now() - start < kMaxDuration) { | 100 while (!tester->finished() && TimeTicks::Now() - start < kMaxDuration) { |
| 101 #if defined(OS_IOS) |
| 102 // Ensure that the other thread has a chance to run even on a single-core |
| 103 // device. |
| 104 pthread_yield_np(); |
| 105 #endif |
101 MessageLoop::current()->RunAllPending(); | 106 MessageLoop::current()->RunAllPending(); |
102 } | 107 } |
103 EXPECT_TRUE(tester->finished()); | 108 EXPECT_TRUE(tester->finished()); |
104 } | 109 } |
105 | 110 |
106 } // namespace base | 111 } // namespace base |
OLD | NEW |