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 VoidDBBusMethodCallbackThunk(const VoidDBusMethodCallback
& callback
) {
17 callback
.Run(DBUS_METHOD_CALL_SUCCESS
);
21 FakeLeadershipDaemonManagerClient::FakeLeadershipDaemonManagerClient() {
24 FakeLeadershipDaemonManagerClient::~FakeLeadershipDaemonManagerClient() {
27 void FakeLeadershipDaemonManagerClient::Init(dbus::Bus
* bus
) {
30 void FakeLeadershipDaemonManagerClient::AddObserver(Observer
* observer
) {
33 void FakeLeadershipDaemonManagerClient::RemoveObserver(Observer
* observer
) {
36 void FakeLeadershipDaemonManagerClient::JoinGroup(
37 const std::string
& group
,
38 const base::DictionaryValue
& options
,
39 const StringDBusMethodCallback
& callback
) {
40 base::MessageLoop::current()->PostTask(
41 FROM_HERE
, base::Bind(&StringDBBusMethodCallbackThunk
, callback
));
44 void FakeLeadershipDaemonManagerClient::LeaveGroup(
45 const std::string
& object_path
,
46 const VoidDBusMethodCallback
& callback
) {
47 base::MessageLoop::current()->PostTask(
48 FROM_HERE
, base::Bind(&VoidDBBusMethodCallbackThunk
, callback
));
51 void FakeLeadershipDaemonManagerClient::SetScore(
52 const std::string
& object_path
,
54 const VoidDBusMethodCallback
& callback
) {
55 base::MessageLoop::current()->PostTask(
56 FROM_HERE
, base::Bind(&VoidDBBusMethodCallbackThunk
, callback
));
59 void FakeLeadershipDaemonManagerClient::PokeLeader(
60 const std::string
& object_path
,
61 const VoidDBusMethodCallback
& callback
) {
62 base::MessageLoop::current()->PostTask(
63 FROM_HERE
, base::Bind(&VoidDBBusMethodCallbackThunk
, callback
));
66 void FakeLeadershipDaemonManagerClient::Ping(
67 const StringDBusMethodCallback
& callback
) {
68 base::MessageLoop::current()->PostTask(
69 FROM_HERE
, base::Bind(&StringDBBusMethodCallbackThunk
, callback
));
72 const LeadershipDaemonManagerClient::GroupProperties
*
73 FakeLeadershipDaemonManagerClient::GetGroupProperties(
74 const dbus::ObjectPath
& object_path
) {
78 } // namespace chromeos