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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
// 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.
#include "chromeos/dbus/fake_dbus_thread_manager.h"
#include "chromeos/dbus/dbus_thread_manager_observer.h"
#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
#include "chromeos/dbus/fake_bluetooth_device_client.h"
#include "chromeos/dbus/fake_bluetooth_input_client.h"
#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
#include "chromeos/dbus/fake_cros_disks_client.h"
#include "chromeos/dbus/fake_cryptohome_client.h"
#include "chromeos/dbus/fake_gsm_sms_client.h"
#include "chromeos/dbus/fake_image_burner_client.h"
#include "chromeos/dbus/fake_nfc_adapter_client.h"
#include "chromeos/dbus/fake_nfc_manager_client.h"
#include "chromeos/dbus/fake_power_manager_client.h"
#include "chromeos/dbus/fake_session_manager_client.h"
#include "chromeos/dbus/fake_shill_device_client.h"
#include "chromeos/dbus/fake_shill_manager_client.h"
#include "chromeos/dbus/fake_system_clock_client.h"
#include "chromeos/dbus/fake_update_engine_client.h"
#include "chromeos/dbus/ibus/mock_ibus_client.h"
#include "chromeos/dbus/ibus/mock_ibus_engine_factory_service.h"
#include "chromeos/dbus/ibus/mock_ibus_engine_service.h"
#include "chromeos/dbus/power_policy_controller.h"
namespace chromeos {
FakeDBusThreadManager::FakeDBusThreadManager()
: fake_bluetooth_adapter_client_(new FakeBluetoothAdapterClient()),
fake_bluetooth_agent_manager_client_(new FakeBluetoothAgentManagerClient()),
fake_bluetooth_device_client_(new FakeBluetoothDeviceClient()),
fake_bluetooth_input_client_(new FakeBluetoothInputClient()),
fake_bluetooth_profile_manager_client_(
new FakeBluetoothProfileManagerClient()),
fake_cros_disks_client_(new FakeCrosDisksClient),
fake_cryptohome_client_(new FakeCryptohomeClient),
fake_gsm_sms_client_(new FakeGsmSMSClient),
fake_image_burner_client_(new FakeImageBurnerClient),
fake_nfc_adapter_client_(new FakeNfcAdapterClient()),
fake_nfc_manager_client_(new FakeNfcManagerClient()),
fake_session_manager_client_(new FakeSessionManagerClient),
fake_shill_device_client_(new FakeShillDeviceClient),
fake_shill_manager_client_(new FakeShillManagerClient),
fake_system_clock_client_(new FakeSystemClockClient),
fake_power_manager_client_(new FakePowerManagerClient),
fake_update_engine_client_(new FakeUpdateEngineClient),
ibus_bus_(NULL) {
power_policy_controller_.reset(
new PowerPolicyController(this, fake_power_manager_client_.get()));
}
FakeDBusThreadManager::~FakeDBusThreadManager() {
FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_,
OnDBusThreadManagerDestroying(this));
}
void FakeDBusThreadManager::AddObserver(
DBusThreadManagerObserver* observer) {
DCHECK(observer);
observers_.AddObserver(observer);
}
void FakeDBusThreadManager::RemoveObserver(
DBusThreadManagerObserver* observer) {
DCHECK(observer);
observers_.RemoveObserver(observer);
}
void FakeDBusThreadManager::InitIBusBus(
const std::string& ibus_address,
const base::Closure& closure) {
// Non-null bus address is used to ensure the connection to ibus-daemon.
ibus_bus_ = reinterpret_cast<dbus::Bus*>(0xdeadbeef);
mock_ibus_client_.reset(new MockIBusClient);
mock_ibus_engine_service_.reset(new MockIBusEngineService);
mock_ibus_engine_factory_service_.reset(new MockIBusEngineFactoryService);
}
dbus::Bus* FakeDBusThreadManager::GetSystemBus() {
return NULL;
}
dbus::Bus* FakeDBusThreadManager::GetIBusBus() {
return ibus_bus_;
}
BluetoothAdapterClient*
FakeDBusThreadManager::GetBluetoothAdapterClient() {
return fake_bluetooth_adapter_client_.get();
}
BluetoothAgentManagerClient*
FakeDBusThreadManager::GetBluetoothAgentManagerClient() {
return fake_bluetooth_agent_manager_client_.get();
}
BluetoothDeviceClient*
FakeDBusThreadManager::GetBluetoothDeviceClient() {
return fake_bluetooth_device_client_.get();
}
BluetoothInputClient*
FakeDBusThreadManager::GetBluetoothInputClient() {
return fake_bluetooth_input_client_.get();
}
BluetoothProfileManagerClient*
FakeDBusThreadManager::GetBluetoothProfileManagerClient() {
return fake_bluetooth_profile_manager_client_.get();
}
CrasAudioClient* FakeDBusThreadManager::GetCrasAudioClient() {
return NULL;
}
CrosDisksClient* FakeDBusThreadManager::GetCrosDisksClient() {
return fake_cros_disks_client_.get();
}
CryptohomeClient* FakeDBusThreadManager::GetCryptohomeClient() {
return fake_cryptohome_client_.get();
}
DebugDaemonClient* FakeDBusThreadManager::GetDebugDaemonClient() {
NOTIMPLEMENTED();
return NULL;
}
ShillDeviceClient*
FakeDBusThreadManager::GetShillDeviceClient() {
return fake_shill_device_client_.get();
}
ShillIPConfigClient*
FakeDBusThreadManager::GetShillIPConfigClient() {
NOTIMPLEMENTED();
return NULL;
}
ShillManagerClient*
FakeDBusThreadManager::GetShillManagerClient() {
return fake_shill_manager_client_.get();
}
ShillProfileClient*
FakeDBusThreadManager::GetShillProfileClient() {
NOTIMPLEMENTED();
return NULL;
}
ShillServiceClient*
FakeDBusThreadManager::GetShillServiceClient() {
NOTIMPLEMENTED();
return NULL;
}
GsmSMSClient* FakeDBusThreadManager::GetGsmSMSClient() {
return fake_gsm_sms_client_.get();
}
ImageBurnerClient* FakeDBusThreadManager::GetImageBurnerClient() {
return fake_image_burner_client_.get();
}
IntrospectableClient*
FakeDBusThreadManager::GetIntrospectableClient() {
NOTIMPLEMENTED();
return NULL;
}
ModemMessagingClient*
FakeDBusThreadManager::GetModemMessagingClient() {
NOTIMPLEMENTED();
return NULL;
}
NfcAdapterClient* FakeDBusThreadManager::GetNfcAdapterClient() {
return fake_nfc_adapter_client_.get();
}
NfcManagerClient* FakeDBusThreadManager::GetNfcManagerClient() {
return fake_nfc_manager_client_.get();
}
PermissionBrokerClient*
FakeDBusThreadManager::GetPermissionBrokerClient() {
NOTIMPLEMENTED();
return NULL;
}
PowerManagerClient* FakeDBusThreadManager::GetPowerManagerClient() {
return fake_power_manager_client_.get();
}
PowerPolicyController*
FakeDBusThreadManager::GetPowerPolicyController() {
return power_policy_controller_.get();
}
SessionManagerClient*
FakeDBusThreadManager::GetSessionManagerClient() {
return fake_session_manager_client_.get();
}
SMSClient* FakeDBusThreadManager::GetSMSClient() {
NOTIMPLEMENTED();
return NULL;
}
SystemClockClient* FakeDBusThreadManager::GetSystemClockClient() {
return fake_system_clock_client_.get();
}
UpdateEngineClient* FakeDBusThreadManager::GetUpdateEngineClient() {
return fake_update_engine_client_.get();
}
IBusClient* FakeDBusThreadManager::GetIBusClient() {
return mock_ibus_client_.get();
}
IBusEngineFactoryService*
FakeDBusThreadManager::GetIBusEngineFactoryService() {
return mock_ibus_engine_factory_service_.get();
}
IBusEngineService* FakeDBusThreadManager::GetIBusEngineService(
const dbus::ObjectPath& object_path) {
return mock_ibus_engine_service_.get();
}
void FakeDBusThreadManager::RemoveIBusEngineService(
const dbus::ObjectPath& object_path) {
}
} // namespace chromeos
|