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

Side by Side Diff: base/test/thread_test_helper.cc

Issue 8572034: Convert NewRunnableMethod() to base::Bind() in base::TestThreadHelper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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 | Annotate | Revision Log
« 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/test/thread_test_helper.h" 5 #include "base/test/thread_test_helper.h"
6 6
7 #include "base/bind.h"
7 #include "base/location.h" 8 #include "base/location.h"
8 9
9 namespace base { 10 namespace base {
10 11
11 ThreadTestHelper::ThreadTestHelper(MessageLoopProxy* target_thread) 12 ThreadTestHelper::ThreadTestHelper(MessageLoopProxy* target_thread)
12 : test_result_(false), 13 : test_result_(false),
13 target_thread_(target_thread), 14 target_thread_(target_thread),
14 done_event_(false, false) { 15 done_event_(false, false) {
15 } 16 }
16 17
17 bool ThreadTestHelper::Run() { 18 bool ThreadTestHelper::Run() {
18 if (!target_thread_->PostTask(FROM_HERE, NewRunnableMethod( 19 if (!target_thread_->PostTask(
19 this, &ThreadTestHelper::RunInThread))) { 20 FROM_HERE, base::Bind(&ThreadTestHelper::RunInThread, this))) {
20 return false; 21 return false;
21 } 22 }
22 done_event_.Wait(); 23 done_event_.Wait();
23 return test_result_; 24 return test_result_;
24 } 25 }
25 26
26 void ThreadTestHelper::RunTest() { set_test_result(true); } 27 void ThreadTestHelper::RunTest() { set_test_result(true); }
27 28
28 ThreadTestHelper::~ThreadTestHelper() {} 29 ThreadTestHelper::~ThreadTestHelper() {}
29 30
30 void ThreadTestHelper::RunInThread() { 31 void ThreadTestHelper::RunInThread() {
31 RunTest(); 32 RunTest();
32 done_event_.Signal(); 33 done_event_.Signal();
33 } 34 }
34 35
35 } // namespace base 36 } // 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