OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef DBUS_TEST_SERVICE_H_ | 5 #ifndef DBUS_TEST_SERVICE_H_ |
6 #define DBUS_TEST_SERVICE_H_ | 6 #define DBUS_TEST_SERVICE_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 // Helper function for SendPropertyChangedSignal(). | 167 // Helper function for SendPropertyChangedSignal(). |
168 void SendPropertyChangedSignalInternal(const std::string& name); | 168 void SendPropertyChangedSignalInternal(const std::string& name); |
169 | 169 |
170 // Helper function for RequestOwnership(). | 170 // Helper function for RequestOwnership(). |
171 void RequestOwnershipInternal(base::Callback<void(bool)> callback); | 171 void RequestOwnershipInternal(base::Callback<void(bool)> callback); |
172 | 172 |
173 // Helper function for ReleaseOwnership(). | 173 // Helper function for ReleaseOwnership(). |
174 void ReleaseOwnershipInternal(base::Closure callback); | 174 void ReleaseOwnershipInternal(base::Closure callback); |
175 | 175 |
| 176 // Configures the test service to send a PropertiesChanged signal for the |
| 177 // "Name" property immediately after a call to GetManagedObjects. |
| 178 void SetSendImmediatePropertiesChanged(); |
| 179 |
176 // Sends the response on completion of the performed action. | 180 // Sends the response on completion of the performed action. |
177 void PerformActionResponse( | 181 void PerformActionResponse( |
178 MethodCall* method_call, | 182 MethodCall* method_call, |
179 dbus::ExportedObject::ResponseSender response_sender); | 183 dbus::ExportedObject::ResponseSender response_sender); |
180 | 184 |
181 // Re-requests ownership of the well-known name after releasing it. | 185 // Re-requests ownership of the well-known name after releasing it. |
182 void OwnershipReleased( | 186 void OwnershipReleased( |
183 MethodCall* method_call, | 187 MethodCall* method_call, |
184 dbus::ExportedObject::ResponseSender response_sender); | 188 dbus::ExportedObject::ResponseSender response_sender); |
185 | 189 |
186 // Sends the action response after regaining the well-known name. | 190 // Sends the action response after regaining the well-known name. |
187 void OwnershipRegained( | 191 void OwnershipRegained( |
188 MethodCall* method_call, | 192 MethodCall* method_call, |
189 dbus::ExportedObject::ResponseSender response_sender, | 193 dbus::ExportedObject::ResponseSender response_sender, |
190 bool success); | 194 bool success); |
191 | 195 |
192 // Options to use when requesting service ownership. | 196 // Options to use when requesting service ownership. |
193 Bus::ServiceOwnershipOptions request_ownership_options_; | 197 Bus::ServiceOwnershipOptions request_ownership_options_; |
194 | 198 |
195 scoped_refptr<base::SequencedTaskRunner> dbus_task_runner_; | 199 scoped_refptr<base::SequencedTaskRunner> dbus_task_runner_; |
196 base::WaitableEvent on_name_obtained_; | 200 base::WaitableEvent on_name_obtained_; |
197 // The number of methods actually exported. | 201 // The number of methods actually exported. |
198 int num_exported_methods_; | 202 int num_exported_methods_; |
199 | 203 |
| 204 // True if a PropertiesChanged signal for the "Name" property should be sent |
| 205 // immediately following a call to GetManagedObjects. |
| 206 bool send_immediate_properties_changed_; |
| 207 |
200 // True iff this instance has successfully acquired the name ownership. | 208 // True iff this instance has successfully acquired the name ownership. |
201 bool has_ownership_; | 209 bool has_ownership_; |
202 | 210 |
203 scoped_refptr<Bus> bus_; | 211 scoped_refptr<Bus> bus_; |
204 ExportedObject* exported_object_; | 212 ExportedObject* exported_object_; |
205 ExportedObject* exported_object_manager_; | 213 ExportedObject* exported_object_manager_; |
206 }; | 214 }; |
207 | 215 |
208 } // namespace dbus | 216 } // namespace dbus |
209 | 217 |
210 #endif // DBUS_TEST_SERVICE_H_ | 218 #endif // DBUS_TEST_SERVICE_H_ |
OLD | NEW |