1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chromeos/dbus/fake_leadership_daemon_manager_client.h"
7 #include "base/location.h"
8 #include "base/thread_task_runner_handle.h"
13 void StringDBBusMethodCallbackThunk(const StringDBusMethodCallback
& callback
) {
14 callback
.Run(DBUS_METHOD_CALL_SUCCESS
, std::string());
17 void ObjectPathDBBusMethodCallbackThunk(
18 const ObjectPathDBusMethodCallback
& callback
) {
19 callback
.Run(DBUS_METHOD_CALL_SUCCESS
, dbus::ObjectPath());
22 void VoidDBBusMethodCallbackThunk(const VoidDBusMethodCallback
& callback
) {
23 callback
.Run(DBUS_METHOD_CALL_SUCCESS
);
27 FakeLeadershipDaemonManagerClient::FakeLeadershipDaemonManagerClient() {
30 FakeLeadershipDaemonManagerClient::~FakeLeadershipDaemonManagerClient() {
33 void FakeLeadershipDaemonManagerClient::Init(dbus::Bus
* bus
) {
36 void FakeLeadershipDaemonManagerClient::AddObserver(Observer
* observer
) {
39 void FakeLeadershipDaemonManagerClient::RemoveObserver(Observer
* observer
) {
42 void FakeLeadershipDaemonManagerClient::JoinGroup(
43 const std::string
& group
,
44 const base::DictionaryValue
& options
,
45 const ObjectPathDBusMethodCallback
& callback
) {
46 base::ThreadTaskRunnerHandle::Get()->PostTask(
47 FROM_HERE
, base::Bind(&ObjectPathDBBusMethodCallbackThunk
, callback
));
50 void FakeLeadershipDaemonManagerClient::LeaveGroup(
51 const std::string
& object_path
,
52 const VoidDBusMethodCallback
& callback
) {
53 base::ThreadTaskRunnerHandle::Get()->PostTask(
54 FROM_HERE
, base::Bind(&VoidDBBusMethodCallbackThunk
, callback
));
57 void FakeLeadershipDaemonManagerClient::SetScore(
58 const std::string
& object_path
,
60 const VoidDBusMethodCallback
& callback
) {
61 base::ThreadTaskRunnerHandle::Get()->PostTask(
62 FROM_HERE
, base::Bind(&VoidDBBusMethodCallbackThunk
, callback
));
65 void FakeLeadershipDaemonManagerClient::PokeLeader(
66 const std::string
& object_path
,
67 const VoidDBusMethodCallback
& callback
) {
68 base::ThreadTaskRunnerHandle::Get()->PostTask(
69 FROM_HERE
, base::Bind(&VoidDBBusMethodCallbackThunk
, callback
));
72 void FakeLeadershipDaemonManagerClient::Ping(
73 const StringDBusMethodCallback
& callback
) {
74 base::ThreadTaskRunnerHandle::Get()->PostTask(
75 FROM_HERE
, base::Bind(&StringDBBusMethodCallbackThunk
, callback
));
78 const LeadershipDaemonManagerClient::GroupProperties
*
79 FakeLeadershipDaemonManagerClient::GetGroupProperties(
80 const dbus::ObjectPath
& object_path
) {
84 } // namespace chromeos