blob: 495d2d17d990ad34ed2627b9d3a5bf64e271d0b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_
#define CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_
#include <string>
#include "base/logging.h"
#include "base/observer_list.h"
#include "chromeos/dbus/dbus_thread_manager.h"
namespace dbus {
class Bus;
class ObjectPath;
} // namespace dbus
namespace chromeos {
class DBusThreadManagerObserver;
class FakeBluetoothAdapterClient;
class FakeBluetoothAgentManagerClient;
class FakeBluetoothDeviceClient;
class FakeBluetoothInputClient;
class FakeBluetoothProfileManagerClient;
class FakeCrosDisksClient;
class FakeCryptohomeClient;
class FakeGsmSMSClient;
class FakeNfcAdapterClient;
class FakeNfcManagerClient;
class FakePowerManagerClient;
class FakeImageBurnerClient;
class FakeSessionManagerClient;
class FakeShillDeviceClient;
class FakeShillManagerClient;
class FakeSystemClockClient;
class FakeUpdateEngineClient;
class MockIBusClient;
class MockIBusEngineFactoryService;
class MockIBusEngineService;
// This class provides a fake implementation of DBusThreadManager, which
// hosts fake D-Bus clients.
class FakeDBusThreadManager : public DBusThreadManager {
public:
FakeDBusThreadManager();
virtual ~FakeDBusThreadManager();
virtual void AddObserver(DBusThreadManagerObserver* observer) OVERRIDE;
virtual void RemoveObserver(DBusThreadManagerObserver* observer) OVERRIDE;
virtual void InitIBusBus(const std::string& ibus_address,
const base::Closure& closure) OVERRIDE;
virtual dbus::Bus* GetSystemBus() OVERRIDE;
virtual dbus::Bus* GetIBusBus() OVERRIDE;
virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE;
virtual BluetoothAgentManagerClient*
GetBluetoothAgentManagerClient() OVERRIDE;
virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE;
virtual BluetoothInputClient* GetBluetoothInputClient() OVERRIDE;
virtual BluetoothProfileManagerClient*
GetBluetoothProfileManagerClient() OVERRIDE;
virtual CrasAudioClient* GetCrasAudioClient() OVERRIDE;
virtual CrosDisksClient* GetCrosDisksClient() OVERRIDE;
virtual CryptohomeClient* GetCryptohomeClient() OVERRIDE;
virtual DebugDaemonClient* GetDebugDaemonClient() OVERRIDE;
virtual ShillDeviceClient* GetShillDeviceClient() OVERRIDE;
virtual ShillIPConfigClient* GetShillIPConfigClient() OVERRIDE;
virtual ShillManagerClient* GetShillManagerClient() OVERRIDE;
virtual ShillProfileClient* GetShillProfileClient() OVERRIDE;
virtual ShillServiceClient* GetShillServiceClient() OVERRIDE;
virtual GsmSMSClient* GetGsmSMSClient() OVERRIDE;
virtual ImageBurnerClient* GetImageBurnerClient() OVERRIDE;
virtual IntrospectableClient* GetIntrospectableClient() OVERRIDE;
virtual ModemMessagingClient* GetModemMessagingClient() OVERRIDE;
virtual NfcAdapterClient* GetNfcAdapterClient() OVERRIDE;
virtual NfcManagerClient* GetNfcManagerClient() OVERRIDE;
virtual PermissionBrokerClient* GetPermissionBrokerClient() OVERRIDE;
virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE;
virtual PowerPolicyController* GetPowerPolicyController() OVERRIDE;
virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE;
virtual SMSClient* GetSMSClient() OVERRIDE;
virtual SystemClockClient* GetSystemClockClient() OVERRIDE;
virtual UpdateEngineClient* GetUpdateEngineClient() OVERRIDE;
virtual IBusClient* GetIBusClient() OVERRIDE;
virtual IBusEngineFactoryService* GetIBusEngineFactoryService() OVERRIDE;
virtual IBusEngineService* GetIBusEngineService(
const dbus::ObjectPath& object_path) OVERRIDE;
virtual void RemoveIBusEngineService(
const dbus::ObjectPath& object_path) OVERRIDE;
FakeBluetoothAdapterClient* fake_bluetooth_adapter_client() {
return fake_bluetooth_adapter_client_.get();
}
FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client() {
return fake_bluetooth_agent_manager_client_.get();
}
FakeBluetoothDeviceClient* fake_bluetooth_device_client() {
return fake_bluetooth_device_client_.get();
}
FakeBluetoothInputClient* fake_bluetooth_input_client() {
return fake_bluetooth_input_client_.get();
}
FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client() {
return fake_bluetooth_profile_manager_client_.get();
}
FakeCrosDisksClient* fake_cros_disks_client() {
return fake_cros_disks_client_.get();
}
FakeCryptohomeClient* fake_cryptohome_client() {
return fake_cryptohome_client_.get();
}
FakeGsmSMSClient* fake_gsm_sms_client() {
return fake_gsm_sms_client_.get();
}
FakeImageBurnerClient* fake_image_burner_client() {
return fake_image_burner_client_.get();
}
FakeNfcAdapterClient* fake_nfc_adapter_client() {
return fake_nfc_adapter_client_.get();
}
FakeNfcManagerClient* fake_nfc_manager_client() {
return fake_nfc_manager_client_.get();
}
FakeSessionManagerClient* fake_session_manager_client() {
return fake_session_manager_client_.get();
}
FakeShillDeviceClient* fake_shill_device_client() {
return fake_shill_device_client_.get();
}
FakeShillManagerClient* fake_shill_manager_client() {
return fake_shill_manager_client_.get();
}
FakeSystemClockClient* fake_system_clock_client() {
return fake_system_clock_client_.get();
}
FakePowerManagerClient* fake_power_manager_client() {
return fake_power_manager_client_.get();
}
FakeUpdateEngineClient* fake_update_engine_client() {
return fake_update_engine_client_.get();
}
// TODO(komatsu): Remove IBus related code. crbug.com/275262
MockIBusClient* mock_ibus_client() {
return mock_ibus_client_.get();
}
MockIBusEngineService* mock_ibus_engine_service() {
return mock_ibus_engine_service_.get();
}
MockIBusEngineFactoryService* mock_ibus_engine_factory_service() {
return mock_ibus_engine_factory_service_.get();
}
void set_ibus_bus(dbus::Bus* ibus_bus) {
ibus_bus_ = ibus_bus;
}
private:
// Note: Keep this before other members so they can call AddObserver() in
// their c'tors.
ObserverList<DBusThreadManagerObserver> observers_;
scoped_ptr<FakeBluetoothAdapterClient> fake_bluetooth_adapter_client_;
scoped_ptr<FakeBluetoothAgentManagerClient>
fake_bluetooth_agent_manager_client_;
scoped_ptr<FakeBluetoothDeviceClient> fake_bluetooth_device_client_;
scoped_ptr<FakeBluetoothInputClient> fake_bluetooth_input_client_;
scoped_ptr<FakeBluetoothProfileManagerClient>
fake_bluetooth_profile_manager_client_;
scoped_ptr<FakeCrosDisksClient> fake_cros_disks_client_;
scoped_ptr<FakeCryptohomeClient> fake_cryptohome_client_;
scoped_ptr<FakeGsmSMSClient> fake_gsm_sms_client_;
scoped_ptr<FakeImageBurnerClient> fake_image_burner_client_;
scoped_ptr<FakeNfcAdapterClient> fake_nfc_adapter_client_;
scoped_ptr<FakeNfcManagerClient> fake_nfc_manager_client_;
scoped_ptr<FakeSessionManagerClient> fake_session_manager_client_;
scoped_ptr<FakeShillDeviceClient> fake_shill_device_client_;
scoped_ptr<FakeShillManagerClient> fake_shill_manager_client_;
scoped_ptr<FakeSystemClockClient> fake_system_clock_client_;
scoped_ptr<FakePowerManagerClient> fake_power_manager_client_;
scoped_ptr<FakeUpdateEngineClient> fake_update_engine_client_;
scoped_ptr<MockIBusClient> mock_ibus_client_;
scoped_ptr<MockIBusEngineService> mock_ibus_engine_service_;
scoped_ptr<MockIBusEngineFactoryService> mock_ibus_engine_factory_service_;
scoped_ptr<PowerPolicyController> power_policy_controller_;
dbus::Bus* ibus_bus_;
DISALLOW_COPY_AND_ASSIGN(FakeDBusThreadManager);
};
} // namespace chromeos
#endif // CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_
|