OLD | NEW |
1 // Copyright (c) 2012 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" |
11 #include "dbus/exported_object.h" | 11 #include "dbus/exported_object.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 Response* response = Response::FromMethodCall(method_call); | 184 Response* response = Response::FromMethodCall(method_call); |
185 MessageWriter writer(response); | 185 MessageWriter writer(response); |
186 writer.AppendString(text_message); | 186 writer.AppendString(text_message); |
187 response_sender.Run(response); | 187 response_sender.Run(response); |
188 } | 188 } |
189 | 189 |
190 void TestService::SlowEcho( | 190 void TestService::SlowEcho( |
191 MethodCall* method_call, | 191 MethodCall* method_call, |
192 dbus::ExportedObject::ResponseSender response_sender) { | 192 dbus::ExportedObject::ResponseSender response_sender) { |
193 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); | 193 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout_ms()); |
194 Echo(method_call, response_sender); | 194 Echo(method_call, response_sender); |
195 } | 195 } |
196 | 196 |
197 void TestService::AsyncEcho( | 197 void TestService::AsyncEcho( |
198 MethodCall* method_call, | 198 MethodCall* method_call, |
199 dbus::ExportedObject::ResponseSender response_sender) { | 199 dbus::ExportedObject::ResponseSender response_sender) { |
200 // Schedule a call to Echo() to send an asynchronous response after we return. | 200 // Schedule a call to Echo() to send an asynchronous response after we return. |
201 message_loop()->PostDelayedTask(FROM_HERE, | 201 message_loop()->PostDelayedTask(FROM_HERE, |
202 base::Bind(&TestService::Echo, | 202 base::Bind(&TestService::Echo, |
203 base::Unretained(this), | 203 base::Unretained(this), |
204 method_call, | 204 method_call, |
205 response_sender), | 205 response_sender), |
206 TestTimeouts::tiny_timeout_ms()); | 206 TestTimeouts::tiny_timeout_ms()); |
207 } | 207 } |
208 | 208 |
209 void TestService::BrokenMethod( | 209 void TestService::BrokenMethod( |
210 MethodCall* method_call, | 210 MethodCall* method_call, |
211 dbus::ExportedObject::ResponseSender response_sender) { | 211 dbus::ExportedObject::ResponseSender response_sender) { |
212 response_sender.Run(NULL); | 212 response_sender.Run(NULL); |
213 } | 213 } |
214 | 214 |
215 } // namespace dbus | 215 } // namespace dbus |
OLD | NEW |