| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "mojo/system/test_utils.h" | 5 #include "mojo/system/test_utils.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 void PostTaskAndWait(scoped_refptr<base::TaskRunner> task_runner, | 25 void PostTaskAndWait(scoped_refptr<base::TaskRunner> task_runner, |
| 26 const tracked_objects::Location& from_here, | 26 const tracked_objects::Location& from_here, |
| 27 const base::Closure& task) { | 27 const base::Closure& task) { |
| 28 base::WaitableEvent event(false, false); | 28 base::WaitableEvent event(false, false); |
| 29 task_runner->PostTask(from_here, | 29 task_runner->PostTask(from_here, |
| 30 base::Bind(&PostTaskAndWaitHelper, &event, task)); | 30 base::Bind(&PostTaskAndWaitHelper, &event, task)); |
| 31 event.Wait(); | 31 event.Wait(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 // TestWithIOThreadBase -------------------------------------------------------- | 34 // TestIOThread ---------------------------------------------------------------- |
| 35 | 35 |
| 36 TestWithIOThreadBase::TestWithIOThreadBase() : io_thread_("io_thread") { | 36 TestIOThread::TestIOThread() : io_thread_("test_io_thread") { |
| 37 } | |
| 38 | |
| 39 TestWithIOThreadBase::~TestWithIOThreadBase() { | |
| 40 } | |
| 41 | |
| 42 void TestWithIOThreadBase::SetUp() { | |
| 43 io_thread_.StartWithOptions( | 37 io_thread_.StartWithOptions( |
| 44 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 38 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
| 45 } | 39 } |
| 46 | 40 |
| 47 void TestWithIOThreadBase::TearDown() { | 41 TestIOThread::~TestIOThread() { |
| 48 io_thread_.Stop(); | 42 io_thread_.Stop(); |
| 49 } | 43 } |
| 50 | 44 |
| 51 } // namespace test | 45 } // namespace test |
| 52 } // namespace system | 46 } // namespace system |
| 53 } // namespace mojo | 47 } // namespace mojo |
| OLD | NEW |