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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 ++num_methods; | 156 ++num_methods; |
157 | 157 |
158 // Just print an error message as we don't want to crash tests. | 158 // Just print an error message as we don't want to crash tests. |
159 // Tests will fail at a call to WaitUntilServiceIsStarted(). | 159 // Tests will fail at a call to WaitUntilServiceIsStarted(). |
160 if (num_methods != kNumMethodsToExport) { | 160 if (num_methods != kNumMethodsToExport) { |
161 LOG(ERROR) << "The number of methods does not match"; | 161 LOG(ERROR) << "The number of methods does not match"; |
162 } | 162 } |
163 message_loop->Run(); | 163 message_loop->Run(); |
164 } | 164 } |
165 | 165 |
166 Response* TestService::Echo(MethodCall* method_call) { | 166 void TestService::Echo(MethodCall* method_call, |
167 dbus::ExportedObject::ResponseSender response_sender) { | |
satorux1
2011/11/22 22:38:17
vertical align.
Vince Laviano
2011/11/22 23:16:22
Done.
| |
167 MessageReader reader(method_call); | 168 MessageReader reader(method_call); |
168 std::string text_message; | 169 std::string text_message; |
169 if (!reader.PopString(&text_message)) | 170 if (!reader.PopString(&text_message)) { |
170 return NULL; | 171 response_sender.Run(NULL); |
172 return; | |
173 } | |
171 | 174 |
172 Response* response = Response::FromMethodCall(method_call); | 175 Response* response = Response::FromMethodCall(method_call); |
173 MessageWriter writer(response); | 176 MessageWriter writer(response); |
174 writer.AppendString(text_message); | 177 writer.AppendString(text_message); |
175 return response; | 178 response_sender.Run(response); |
176 } | 179 } |
177 | 180 |
178 Response* TestService::SlowEcho(MethodCall* method_call) { | 181 void TestService::SlowEcho(MethodCall* method_call, |
182 dbus::ExportedObject::ResponseSender response_sender) { | |
satorux1
2011/11/22 22:38:17
ditto.
Vince Laviano
2011/11/22 23:16:22
This one is 82 chars long when vertically aligned.
| |
179 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout_ms()); | 183 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout_ms()); |
180 return Echo(method_call); | 184 Echo(method_call, response_sender); |
181 } | 185 } |
182 | 186 |
183 Response* TestService::BrokenMethod(MethodCall* method_call) { | 187 void TestService::BrokenMethod(MethodCall* method_call, |
184 return NULL; | 188 dbus::ExportedObject::ResponseSender response_sender) { |
satorux1
2011/11/22 22:38:17
ditto
Vince Laviano
2011/11/22 23:16:22
This one is 86. Right aligned at 80. See above.
| |
189 response_sender.Run(NULL); | |
185 } | 190 } |
186 | 191 |
187 } // namespace dbus | 192 } // namespace dbus |
OLD | NEW |