OLD | NEW |
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 "dbus/test_service.h" | 5 #include "dbus/test_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
10 #include "dbus/bus.h" | 10 #include "dbus/bus.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 } | 23 } |
24 | 24 |
25 TestService::TestService(const Options& options) | 25 TestService::TestService(const Options& options) |
26 : base::Thread("TestService"), | 26 : base::Thread("TestService"), |
27 dbus_thread_message_loop_proxy_(options.dbus_thread_message_loop_proxy), | 27 dbus_thread_message_loop_proxy_(options.dbus_thread_message_loop_proxy), |
28 on_all_methods_exported_(false, false), | 28 on_all_methods_exported_(false, false), |
29 num_exported_methods_(0) { | 29 num_exported_methods_(0) { |
30 } | 30 } |
31 | 31 |
32 TestService::~TestService() { | 32 TestService::~TestService() { |
| 33 Stop(); |
33 } | 34 } |
34 | 35 |
35 bool TestService::StartService() { | 36 bool TestService::StartService() { |
36 base::Thread::Options thread_options; | 37 base::Thread::Options thread_options; |
37 thread_options.message_loop_type = MessageLoop::TYPE_IO; | 38 thread_options.message_loop_type = MessageLoop::TYPE_IO; |
38 return StartWithOptions(thread_options); | 39 return StartWithOptions(thread_options); |
39 } | 40 } |
40 | 41 |
41 bool TestService::WaitUntilServiceIsStarted() { | 42 bool TestService::WaitUntilServiceIsStarted() { |
42 const base::TimeDelta timeout( | 43 const base::TimeDelta timeout( |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 Response* TestService::SlowEcho(MethodCall* method_call) { | 178 Response* TestService::SlowEcho(MethodCall* method_call) { |
178 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout_ms()); | 179 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout_ms()); |
179 return Echo(method_call); | 180 return Echo(method_call); |
180 } | 181 } |
181 | 182 |
182 Response* TestService::BrokenMethod(MethodCall* method_call) { | 183 Response* TestService::BrokenMethod(MethodCall* method_call) { |
183 return NULL; | 184 return NULL; |
184 } | 185 } |
185 | 186 |
186 } // namespace dbus | 187 } // namespace dbus |
OLD | NEW |