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/message_loop/message_loop.h"
12 void StringDBBusMethodCallbackThunk(const StringDBusMethodCallback
& callback
) {
13 callback
.Run(DBUS_METHOD_CALL_SUCCESS
, std::string());
16 void ObjectPathDBBusMethodCallbackThunk(
17 const ObjectPathDBusMethodCallback
& callback
) {
18 callback
.Run(DBUS_METHOD_CALL_SUCCESS
, dbus::ObjectPath());
21 void VoidDBBusMethodCallbackThunk(const VoidDBusMethodCallback
& callback
) {
22 callback
.Run(DBUS_METHOD_CALL_SUCCESS
);
26 FakeLeadershipDaemonManagerClient::FakeLeadershipDaemonManagerClient() {
29 FakeLeadershipDaemonManagerClient::~FakeLeadershipDaemonManagerClient() {
32 void FakeLeadershipDaemonManagerClient::Init(dbus::Bus
* bus
) {
35 void FakeLeadershipDaemonManagerClient::AddObserver(Observer
* observer
) {
38 void FakeLeadershipDaemonManagerClient::RemoveObserver(Observer
* observer
) {
41 void FakeLeadershipDaemonManagerClient::JoinGroup(
42 const std::string
& group
,
43 const base::DictionaryValue
& options
,
44 const ObjectPathDBusMethodCallback
& callback
) {
45 base::MessageLoop::current()->PostTask(
46 FROM_HERE
, base::Bind(&ObjectPathDBBusMethodCallbackThunk
, callback
));
49 void FakeLeadershipDaemonManagerClient::LeaveGroup(
50 const std::string
& object_path
,
51 const VoidDBusMethodCallback
& callback
) {
52 base::MessageLoop::current()->PostTask(
53 FROM_HERE
, base::Bind(&VoidDBBusMethodCallbackThunk
, callback
));
56 void FakeLeadershipDaemonManagerClient::SetScore(
57 const std::string
& object_path
,
59 const VoidDBusMethodCallback
& callback
) {
60 base::MessageLoop::current()->PostTask(
61 FROM_HERE
, base::Bind(&VoidDBBusMethodCallbackThunk
, callback
));
64 void FakeLeadershipDaemonManagerClient::PokeLeader(
65 const std::string
& object_path
,
66 const VoidDBusMethodCallback
& callback
) {
67 base::MessageLoop::current()->PostTask(
68 FROM_HERE
, base::Bind(&VoidDBBusMethodCallbackThunk
, callback
));
71 void FakeLeadershipDaemonManagerClient::Ping(
72 const StringDBusMethodCallback
& callback
) {
73 base::MessageLoop::current()->PostTask(
74 FROM_HERE
, base::Bind(&StringDBBusMethodCallbackThunk
, callback
));
77 const LeadershipDaemonManagerClient::GroupProperties
*
78 FakeLeadershipDaemonManagerClient::GetGroupProperties(
79 const dbus::ObjectPath
& object_path
) {
83 } // namespace chromeos