Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: base/threading/worker_pool_unittest.cc

Issue 10810061: Give the post-and-reply worker pool test a chance to finish on iOS (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698