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 -------------------------------------------------------- |
| 35 |
| 36 TestWithIOThreadBase::TestWithIOThreadBase() : io_thread_("io_thread") { |
| 37 } |
| 38 |
| 39 TestWithIOThreadBase::~TestWithIOThreadBase() { |
| 40 } |
| 41 |
| 42 void TestWithIOThreadBase::SetUp() { |
| 43 io_thread_.StartWithOptions( |
| 44 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
| 45 } |
| 46 |
| 47 void TestWithIOThreadBase::TearDown() { |
| 48 io_thread_.Stop(); |
| 49 } |
| 50 |
34 } // namespace test | 51 } // namespace test |
35 } // namespace system | 52 } // namespace system |
36 } // namespace mojo | 53 } // namespace mojo |
OLD | NEW |