| Index: dbus/test_service.cc
|
| diff --git a/dbus/test_service.cc b/dbus/test_service.cc
|
| index a4e152a77433020758e75d0d21f103f7f02a7a32..7b36082b66cb66746f1643608eee52527012ed79 100644
|
| --- a/dbus/test_service.cc
|
| +++ b/dbus/test_service.cc
|
| @@ -10,6 +10,7 @@
|
| #include <vector>
|
|
|
| #include "base/bind.h"
|
| +#include "base/guid.h"
|
| #include "base/test/test_timeouts.h"
|
| #include "base/threading/platform_thread.h"
|
| #include "dbus/bus.h"
|
| @@ -41,6 +42,7 @@ TestService::Options::~Options() {
|
|
|
| TestService::TestService(const Options& options)
|
| : base::Thread("TestService"),
|
| + service_name_(options.service_name),
|
| request_ownership_options_(options.request_ownership_options),
|
| dbus_task_runner_(options.dbus_task_runner),
|
| on_name_obtained_(false, false),
|
| @@ -49,6 +51,9 @@ TestService::TestService(const Options& options)
|
| has_ownership_(false),
|
| exported_object_(NULL),
|
| exported_object_manager_(NULL) {
|
| + if (service_name_.empty()) {
|
| + service_name_ = "org.chromium.TestService-" + base::GenerateGUID();
|
| + }
|
| }
|
|
|
| TestService::~TestService() {
|
| @@ -113,7 +118,7 @@ void TestService::SendTestSignalFromRootInternal(const std::string& message) {
|
| MessageWriter writer(&signal);
|
| writer.AppendString(message);
|
|
|
| - bus_->RequestOwnership("org.chromium.TestService",
|
| + bus_->RequestOwnership(service_name_,
|
| request_ownership_options_,
|
| base::Bind(&TestService::OnOwnership,
|
| base::Unretained(this),
|
| @@ -134,7 +139,7 @@ void TestService::RequestOwnership(base::Callback<void(bool)> callback) {
|
|
|
| void TestService::RequestOwnershipInternal(
|
| base::Callback<void(bool)> callback) {
|
| - bus_->RequestOwnership("org.chromium.TestService",
|
| + bus_->RequestOwnership(service_name_,
|
| request_ownership_options_,
|
| base::Bind(&TestService::OnOwnership,
|
| base::Unretained(this),
|
| @@ -161,7 +166,7 @@ void TestService::ReleaseOwnership(base::Closure callback) {
|
|
|
| void TestService::ReleaseOwnershipInternal(
|
| base::Closure callback) {
|
| - bus_->ReleaseOwnership("org.chromium.TestService");
|
| + bus_->ReleaseOwnership(service_name_);
|
| has_ownership_ = false;
|
|
|
| bus_->GetOriginTaskRunner()->PostTask(
|
| @@ -188,7 +193,7 @@ void TestService::OnExported(const std::string& interface_name,
|
| if (num_exported_methods_ == kNumMethodsToExport) {
|
| // As documented in exported_object.h, the service name should be
|
| // requested after all methods are exposed.
|
| - bus_->RequestOwnership("org.chromium.TestService",
|
| + bus_->RequestOwnership(service_name_,
|
| request_ownership_options_,
|
| base::Bind(&TestService::OnOwnership,
|
| base::Unretained(this),
|
|
|