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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 #define MAYBE_PostTaskAndReply DISABLED_PostTaskAndReply | 88 #define MAYBE_PostTaskAndReply DISABLED_PostTaskAndReply |
89 #else | 89 #else |
90 #define MAYBE_PostTaskAndReply PostTaskAndReply | 90 #define MAYBE_PostTaskAndReply PostTaskAndReply |
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 = | 98 const TimeDelta kMaxDuration = TestTimeouts::tiny_timeout(); |
99 TimeDelta::FromMilliseconds(TestTimeouts::tiny_timeout_ms()); | |
100 TimeTicks start = TimeTicks::Now(); | 99 TimeTicks start = TimeTicks::Now(); |
101 while (!tester->finished() && TimeTicks::Now() - start < kMaxDuration) { | 100 while (!tester->finished() && TimeTicks::Now() - start < kMaxDuration) { |
102 MessageLoop::current()->RunAllPending(); | 101 MessageLoop::current()->RunAllPending(); |
103 } | 102 } |
104 EXPECT_TRUE(tester->finished()); | 103 EXPECT_TRUE(tester->finished()); |
105 } | 104 } |
106 | 105 |
107 } // namespace base | 106 } // namespace base |
OLD | NEW |