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

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

Issue 7239023: Move the thread test helper to base/test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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 | Annotate | Revision Log
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 "chrome/test/thread_test_helper.h" 5 #include "base/test/thread_test_helper.h"
6 6
7 ThreadTestHelper::ThreadTestHelper(BrowserThread::ID thread_id) 7 namespace base {
8
9 ThreadTestHelper::ThreadTestHelper(MessageLoopProxy* target_thread)
8 : test_result_(false), 10 : test_result_(false),
9 thread_id_(thread_id), 11 target_thread_(target_thread),
10 done_event_(false, false) { 12 done_event_(false, false) {
11 } 13 }
12 14
13 bool ThreadTestHelper::Run() { 15 bool ThreadTestHelper::Run() {
14 if (!BrowserThread::PostTask(thread_id_, FROM_HERE, NewRunnableMethod( 16 if (!target_thread_->PostTask(FROM_HERE, NewRunnableMethod(
15 this, &ThreadTestHelper::RunInThread))) { 17 this, &ThreadTestHelper::RunInThread))) {
16 return false; 18 return false;
17 } 19 }
18 done_event_.Wait(); 20 done_event_.Wait();
19 return test_result_; 21 return test_result_;
20 } 22 }
21 23
22 void ThreadTestHelper::RunTest() { set_test_result(true); } 24 void ThreadTestHelper::RunTest() { set_test_result(true); }
23 25
24 ThreadTestHelper::~ThreadTestHelper() {} 26 ThreadTestHelper::~ThreadTestHelper() {}
25 27
26 void ThreadTestHelper::RunInThread() { 28 void ThreadTestHelper::RunInThread() {
27 RunTest(); 29 RunTest();
28 done_event_.Signal(); 30 done_event_.Signal();
29 } 31 }
32
33 } // namespace base
OLDNEW
« no previous file with comments | « base/test/thread_test_helper.h ('k') | chrome/browser/browsing_data_local_storage_helper_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698