| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/test/thread_test_helper.h" | |
| 6 | |
| 7 ThreadTestHelper::ThreadTestHelper(BrowserThread::ID thread_id) | |
| 8 : test_result_(false), | |
| 9 thread_id_(thread_id), | |
| 10 done_event_(false, false) { | |
| 11 } | |
| 12 | |
| 13 bool ThreadTestHelper::Run() { | |
| 14 if (!BrowserThread::PostTask(thread_id_, FROM_HERE, NewRunnableMethod( | |
| 15 this, &ThreadTestHelper::RunInThread))) { | |
| 16 return false; | |
| 17 } | |
| 18 done_event_.Wait(); | |
| 19 return test_result_; | |
| 20 } | |
| 21 | |
| 22 void ThreadTestHelper::RunTest() { set_test_result(true); } | |
| 23 | |
| 24 ThreadTestHelper::~ThreadTestHelper() {} | |
| 25 | |
| 26 void ThreadTestHelper::RunInThread() { | |
| 27 RunTest(); | |
| 28 done_event_.Signal(); | |
| 29 } | |
| OLD | NEW |