Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1686)

Unified Diff: dbus/test_service.cc

Issue 9668018: dbus: remove service name from ExportedObject (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pay more attention when fixing mock Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dbus/test_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/test_service.cc
diff --git a/dbus/test_service.cc b/dbus/test_service.cc
index 23c4bc556ef59f4e00b7aa1e5265235de0112ae9..7532d5bc5f178aa4706f120577a2944d9eb380e2 100644
--- a/dbus/test_service.cc
+++ b/dbus/test_service.cc
@@ -95,13 +95,21 @@ void TestService::SendTestSignalFromRootInternal(const std::string& message) {
dbus::MessageWriter writer(&signal);
writer.AppendString(message);
+ bus_->RequestOwnership("org.chromium.TestService",
+ base::Bind(&TestService::OnOwnership,
+ base::Unretained(this)));
+
// Use "/" just like dbus-send does.
ExportedObject* root_object =
- bus_->GetExportedObject("org.chromium.TestService",
- dbus::ObjectPath("/"));
+ bus_->GetExportedObject(dbus::ObjectPath("/"));
root_object->SendSignal(&signal);
}
+void TestService::OnOwnership(const std::string& service_name,
+ bool success) {
+ LOG_IF(ERROR, !success) << "Failed to own: " << service_name;
+}
+
void TestService::OnExported(const std::string& interface_name,
const std::string& method_name,
bool success) {
@@ -125,8 +133,11 @@ void TestService::Run(MessageLoop* message_loop) {
bus_options.dbus_thread_message_loop_proxy = dbus_thread_message_loop_proxy_;
bus_ = new Bus(bus_options);
+ bus_->RequestOwnership("org.chromium.TestService",
+ base::Bind(&TestService::OnOwnership,
+ base::Unretained(this)));
+
exported_object_ = bus_->GetExportedObject(
- "org.chromium.TestService",
dbus::ObjectPath("/org/chromium/TestObject"));
int num_methods = 0;
« no previous file with comments | « dbus/test_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698