Fix compilation error encountered when DEBUG set to 1.
[chromium-blink-merge.git] / chromeos / dbus / fake_dbus_thread_manager.cc
blob10b78354e7c752f66b1efa334fd5083983029b9d
1 // Copyright (c) 2012 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_dbus_thread_manager.h"
7 #include "base/command_line.h"
8 #include "chromeos/chromeos_switches.h"
9 #include "chromeos/dbus/cras_audio_client_stub_impl.h"
10 #include "chromeos/dbus/cros_disks_client.h"
11 #include "chromeos/dbus/dbus_client.h"
12 #include "chromeos/dbus/dbus_thread_manager.h"
13 #include "chromeos/dbus/dbus_thread_manager_observer.h"
14 #include "chromeos/dbus/fake_bluetooth_adapter_client.h"
15 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
16 #include "chromeos/dbus/fake_bluetooth_device_client.h"
17 #include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h"
18 #include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h"
19 #include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h"
20 #include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
21 #include "chromeos/dbus/fake_bluetooth_input_client.h"
22 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
23 #include "chromeos/dbus/fake_cryptohome_client.h"
24 #include "chromeos/dbus/fake_debug_daemon_client.h"
25 #include "chromeos/dbus/fake_gsm_sms_client.h"
26 #include "chromeos/dbus/fake_image_burner_client.h"
27 #include "chromeos/dbus/fake_introspectable_client.h"
28 #include "chromeos/dbus/fake_lorgnette_manager_client.h"
29 #include "chromeos/dbus/fake_modem_messaging_client.h"
30 #include "chromeos/dbus/fake_nfc_adapter_client.h"
31 #include "chromeos/dbus/fake_nfc_device_client.h"
32 #include "chromeos/dbus/fake_nfc_manager_client.h"
33 #include "chromeos/dbus/fake_nfc_record_client.h"
34 #include "chromeos/dbus/fake_nfc_tag_client.h"
35 #include "chromeos/dbus/fake_permission_broker_client.h"
36 #include "chromeos/dbus/fake_shill_device_client.h"
37 #include "chromeos/dbus/fake_shill_ipconfig_client.h"
38 #include "chromeos/dbus/fake_shill_manager_client.h"
39 #include "chromeos/dbus/fake_shill_profile_client.h"
40 #include "chromeos/dbus/fake_shill_service_client.h"
41 #include "chromeos/dbus/fake_sms_client.h"
42 #include "chromeos/dbus/fake_system_clock_client.h"
43 #include "chromeos/dbus/power_manager_client.h"
44 #include "chromeos/dbus/power_policy_controller.h"
45 #include "chromeos/dbus/session_manager_client.h"
46 #include "chromeos/dbus/update_engine_client.h"
48 namespace chromeos {
50 FakeDBusThreadManager::FakeDBusThreadManager() {
53 FakeDBusThreadManager::~FakeDBusThreadManager() {
54 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_,
55 OnDBusThreadManagerDestroying(this));
58 void FakeDBusThreadManager::SetFakeClients() {
59 const DBusClientImplementationType client_type =
60 STUB_DBUS_CLIENT_IMPLEMENTATION;
61 SetBluetoothAdapterClient(
62 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient));
63 SetBluetoothAgentManagerClient(scoped_ptr<BluetoothAgentManagerClient>(
64 new FakeBluetoothAgentManagerClient));
65 SetBluetoothDeviceClient(
66 scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient));
67 SetBluetoothGattCharacteristicClient(
68 scoped_ptr<BluetoothGattCharacteristicClient>(
69 new FakeBluetoothGattCharacteristicClient));
70 SetBluetoothGattDescriptorClient(scoped_ptr<BluetoothGattDescriptorClient>(
71 new FakeBluetoothGattDescriptorClient));
72 SetBluetoothGattManagerClient(scoped_ptr<BluetoothGattManagerClient>(
73 new FakeBluetoothGattManagerClient));
74 SetBluetoothGattServiceClient(scoped_ptr<BluetoothGattServiceClient>(
75 new FakeBluetoothGattServiceClient));
76 SetBluetoothInputClient(
77 scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient));
78 SetBluetoothProfileManagerClient(scoped_ptr<BluetoothProfileManagerClient>(
79 new FakeBluetoothProfileManagerClient));
80 SetCrosDisksClient(
81 scoped_ptr<CrosDisksClient>(CrosDisksClient::Create(client_type)));
82 SetCrasAudioClient(scoped_ptr<CrasAudioClient>(new CrasAudioClientStubImpl));
83 SetCryptohomeClient(scoped_ptr<CryptohomeClient>(new FakeCryptohomeClient));
84 SetDebugDaemonClient(
85 scoped_ptr<DebugDaemonClient>(new FakeDebugDaemonClient));
86 SetLorgnetteManagerClient(
87 scoped_ptr<LorgnetteManagerClient>(new FakeLorgnetteManagerClient));
89 SetFakeShillClients();
91 FakeGsmSMSClient* gsm_sms_client = new FakeGsmSMSClient();
92 gsm_sms_client->set_sms_test_message_switch_present(
93 CommandLine::ForCurrentProcess()->HasSwitch(
94 chromeos::switches::kSmsTestMessages));
95 SetGsmSMSClient(scoped_ptr<GsmSMSClient>(gsm_sms_client));
97 SetImageBurnerClient(
98 scoped_ptr<ImageBurnerClient>(new FakeImageBurnerClient));
99 SetIntrospectableClient(
100 scoped_ptr<IntrospectableClient>(new FakeIntrospectableClient));
101 SetModemMessagingClient(
102 scoped_ptr<ModemMessagingClient>(new FakeModemMessagingClient));
103 SetNfcAdapterClient(scoped_ptr<NfcAdapterClient>(new FakeNfcAdapterClient));
104 SetNfcDeviceClient(scoped_ptr<NfcDeviceClient>(new FakeNfcDeviceClient));
105 SetNfcManagerClient(scoped_ptr<NfcManagerClient>(new FakeNfcManagerClient));
106 SetNfcRecordClient(scoped_ptr<NfcRecordClient>(new FakeNfcRecordClient));
107 SetNfcTagClient(scoped_ptr<NfcTagClient>(new FakeNfcTagClient));
108 SetPermissionBrokerClient(
109 scoped_ptr<PermissionBrokerClient>(new FakePermissionBrokerClient));
110 SetPowerManagerClient(
111 scoped_ptr<PowerManagerClient>(PowerManagerClient::Create(client_type)));
112 SetSessionManagerClient(scoped_ptr<SessionManagerClient>(
113 SessionManagerClient::Create(client_type)));
114 SetSMSClient(scoped_ptr<SMSClient>(new FakeSMSClient));
115 SetSystemClockClient(
116 scoped_ptr<SystemClockClient>(new FakeSystemClockClient));
117 SetUpdateEngineClient(
118 scoped_ptr<UpdateEngineClient>(UpdateEngineClient::Create(client_type)));
120 SetPowerPolicyController(make_scoped_ptr(new PowerPolicyController));
123 void FakeDBusThreadManager::SetFakeShillClients() {
124 SetShillManagerClient(
125 scoped_ptr<ShillManagerClient>(new FakeShillManagerClient));
126 SetShillDeviceClient(
127 scoped_ptr<ShillDeviceClient>(new FakeShillDeviceClient));
128 SetShillIPConfigClient(
129 scoped_ptr<ShillIPConfigClient>(new FakeShillIPConfigClient));
130 SetShillServiceClient(
131 scoped_ptr<ShillServiceClient>(new FakeShillServiceClient));
132 SetShillProfileClient(
133 scoped_ptr<ShillProfileClient>(new FakeShillProfileClient));
136 void FakeDBusThreadManager::SetupDefaultEnvironment() {
137 ShillManagerClient::TestInterface* manager =
138 shill_manager_client_->GetTestInterface();
139 if (manager)
140 manager->SetupDefaultEnvironment();
143 void FakeDBusThreadManager::SetBluetoothAdapterClient(
144 scoped_ptr<BluetoothAdapterClient> client) {
145 bluetooth_adapter_client_ = client.Pass();
148 void FakeDBusThreadManager::SetBluetoothAgentManagerClient(
149 scoped_ptr<BluetoothAgentManagerClient> client) {
150 bluetooth_agent_manager_client_ = client.Pass();
153 void FakeDBusThreadManager::SetBluetoothDeviceClient(
154 scoped_ptr<BluetoothDeviceClient> client) {
155 bluetooth_device_client_ = client.Pass();
158 void FakeDBusThreadManager::SetBluetoothGattCharacteristicClient(
159 scoped_ptr<BluetoothGattCharacteristicClient> client) {
160 bluetooth_gatt_characteristic_client_ = client.Pass();
163 void FakeDBusThreadManager::SetBluetoothGattDescriptorClient(
164 scoped_ptr<BluetoothGattDescriptorClient> client) {
165 bluetooth_gatt_descriptor_client_ = client.Pass();
168 void FakeDBusThreadManager::SetBluetoothGattManagerClient(
169 scoped_ptr<BluetoothGattManagerClient> client) {
170 bluetooth_gatt_manager_client_ = client.Pass();
173 void FakeDBusThreadManager::SetBluetoothGattServiceClient(
174 scoped_ptr<BluetoothGattServiceClient> client) {
175 bluetooth_gatt_service_client_ = client.Pass();
178 void FakeDBusThreadManager::SetBluetoothInputClient(
179 scoped_ptr<BluetoothInputClient> client) {
180 bluetooth_input_client_ = client.Pass();
183 void FakeDBusThreadManager::SetBluetoothProfileManagerClient(
184 scoped_ptr<BluetoothProfileManagerClient> client) {
185 bluetooth_profile_manager_client_ = client.Pass();
188 void FakeDBusThreadManager::SetCrasAudioClient(
189 scoped_ptr<CrasAudioClient> client) {
190 cras_audio_client_ = client.Pass();
193 void FakeDBusThreadManager::SetCrosDisksClient(
194 scoped_ptr<CrosDisksClient> client) {
195 cros_disks_client_ = client.Pass();
198 void FakeDBusThreadManager::SetCryptohomeClient(
199 scoped_ptr<CryptohomeClient> client) {
200 cryptohome_client_ = client.Pass();
203 void FakeDBusThreadManager::SetDebugDaemonClient(
204 scoped_ptr<DebugDaemonClient> client) {
205 debug_daemon_client_ = client.Pass();
208 void FakeDBusThreadManager::SetLorgnetteManagerClient(
209 scoped_ptr<LorgnetteManagerClient> client) {
210 lorgnette_manager_client_ = client.Pass();
213 void FakeDBusThreadManager::SetShillDeviceClient(
214 scoped_ptr<ShillDeviceClient> client) {
215 shill_device_client_ = client.Pass();
218 void FakeDBusThreadManager::SetShillIPConfigClient(
219 scoped_ptr<ShillIPConfigClient> client) {
220 shill_ipconfig_client_ = client.Pass();
223 void FakeDBusThreadManager::SetShillManagerClient(
224 scoped_ptr<ShillManagerClient> client) {
225 shill_manager_client_ = client.Pass();
228 void FakeDBusThreadManager::SetShillServiceClient(
229 scoped_ptr<ShillServiceClient> client) {
230 shill_service_client_ = client.Pass();
233 void FakeDBusThreadManager::SetShillProfileClient(
234 scoped_ptr<ShillProfileClient> client) {
235 shill_profile_client_ = client.Pass();
238 void FakeDBusThreadManager::SetGsmSMSClient(
239 scoped_ptr<GsmSMSClient> client) {
240 gsm_sms_client_ = client.Pass();
243 void FakeDBusThreadManager::SetImageBurnerClient(
244 scoped_ptr<ImageBurnerClient> client) {
245 image_burner_client_ = client.Pass();
248 void FakeDBusThreadManager::SetIntrospectableClient(
249 scoped_ptr<IntrospectableClient> client) {
250 introspectable_client_ = client.Pass();
253 void FakeDBusThreadManager::SetModemMessagingClient(
254 scoped_ptr<ModemMessagingClient> client) {
255 modem_messaging_client_ = client.Pass();
258 void FakeDBusThreadManager::SetNfcAdapterClient(
259 scoped_ptr<NfcAdapterClient> client) {
260 nfc_adapter_client_ = client.Pass();
263 void FakeDBusThreadManager::SetNfcDeviceClient(
264 scoped_ptr<NfcDeviceClient> client) {
265 nfc_device_client_ = client.Pass();
268 void FakeDBusThreadManager::SetNfcManagerClient(
269 scoped_ptr<NfcManagerClient> client) {
270 nfc_manager_client_ = client.Pass();
273 void FakeDBusThreadManager::SetNfcRecordClient(
274 scoped_ptr<NfcRecordClient> client) {
275 nfc_record_client_ = client.Pass();
278 void FakeDBusThreadManager::SetNfcTagClient(
279 scoped_ptr<NfcTagClient> client) {
280 nfc_tag_client_ = client.Pass();
283 void FakeDBusThreadManager::SetPermissionBrokerClient(
284 scoped_ptr<PermissionBrokerClient> client) {
285 permission_broker_client_ = client.Pass();
288 void FakeDBusThreadManager::SetPowerManagerClient(
289 scoped_ptr<PowerManagerClient> client) {
290 power_manager_client_ = client.Pass();
293 void FakeDBusThreadManager::SetPowerPolicyController(
294 scoped_ptr<PowerPolicyController> client) {
295 power_policy_controller_ = client.Pass();
298 void FakeDBusThreadManager::SetSessionManagerClient(
299 scoped_ptr<SessionManagerClient> client) {
300 session_manager_client_ = client.Pass();
303 void FakeDBusThreadManager::SetSMSClient(scoped_ptr<SMSClient> client) {
304 sms_client_ = client.Pass();
307 void FakeDBusThreadManager::SetSystemClockClient(
308 scoped_ptr<SystemClockClient> client) {
309 system_clock_client_ = client.Pass();
312 void FakeDBusThreadManager::SetUpdateEngineClient(
313 scoped_ptr<UpdateEngineClient> client) {
314 update_engine_client_ = client.Pass();
317 void FakeDBusThreadManager::AddObserver(
318 DBusThreadManagerObserver* observer) {
319 DCHECK(observer);
320 observers_.AddObserver(observer);
323 void FakeDBusThreadManager::RemoveObserver(
324 DBusThreadManagerObserver* observer) {
325 DCHECK(observer);
326 observers_.RemoveObserver(observer);
329 dbus::Bus* FakeDBusThreadManager::GetSystemBus() {
330 return NULL;
333 BluetoothAdapterClient*
334 FakeDBusThreadManager::GetBluetoothAdapterClient() {
335 return bluetooth_adapter_client_.get();
338 BluetoothAgentManagerClient*
339 FakeDBusThreadManager::GetBluetoothAgentManagerClient() {
340 return bluetooth_agent_manager_client_.get();
343 BluetoothDeviceClient*
344 FakeDBusThreadManager::GetBluetoothDeviceClient() {
345 return bluetooth_device_client_.get();
348 BluetoothGattCharacteristicClient*
349 FakeDBusThreadManager::GetBluetoothGattCharacteristicClient() {
350 return bluetooth_gatt_characteristic_client_.get();
353 BluetoothGattDescriptorClient*
354 FakeDBusThreadManager::GetBluetoothGattDescriptorClient() {
355 return bluetooth_gatt_descriptor_client_.get();
358 BluetoothGattManagerClient*
359 FakeDBusThreadManager::GetBluetoothGattManagerClient() {
360 return bluetooth_gatt_manager_client_.get();
363 BluetoothGattServiceClient*
364 FakeDBusThreadManager::GetBluetoothGattServiceClient() {
365 return bluetooth_gatt_service_client_.get();
368 BluetoothInputClient*
369 FakeDBusThreadManager::GetBluetoothInputClient() {
370 return bluetooth_input_client_.get();
373 BluetoothProfileManagerClient*
374 FakeDBusThreadManager::GetBluetoothProfileManagerClient() {
375 return bluetooth_profile_manager_client_.get();
378 CrasAudioClient* FakeDBusThreadManager::GetCrasAudioClient() {
379 return cras_audio_client_.get();
382 CrosDisksClient* FakeDBusThreadManager::GetCrosDisksClient() {
383 return cros_disks_client_.get();
386 CryptohomeClient* FakeDBusThreadManager::GetCryptohomeClient() {
387 return cryptohome_client_.get();
390 DebugDaemonClient* FakeDBusThreadManager::GetDebugDaemonClient() {
391 return debug_daemon_client_.get();
394 LorgnetteManagerClient* FakeDBusThreadManager::GetLorgnetteManagerClient() {
395 return lorgnette_manager_client_.get();
398 ShillDeviceClient*
399 FakeDBusThreadManager::GetShillDeviceClient() {
400 return shill_device_client_.get();
403 ShillIPConfigClient*
404 FakeDBusThreadManager::GetShillIPConfigClient() {
405 return shill_ipconfig_client_.get();
408 ShillManagerClient*
409 FakeDBusThreadManager::GetShillManagerClient() {
410 return shill_manager_client_.get();
413 ShillProfileClient*
414 FakeDBusThreadManager::GetShillProfileClient() {
415 return shill_profile_client_.get();
418 ShillServiceClient*
419 FakeDBusThreadManager::GetShillServiceClient() {
420 return shill_service_client_.get();
423 GsmSMSClient* FakeDBusThreadManager::GetGsmSMSClient() {
424 return gsm_sms_client_.get();
427 ImageBurnerClient* FakeDBusThreadManager::GetImageBurnerClient() {
428 return image_burner_client_.get();
431 IntrospectableClient*
432 FakeDBusThreadManager::GetIntrospectableClient() {
433 return introspectable_client_.get();
436 ModemMessagingClient*
437 FakeDBusThreadManager::GetModemMessagingClient() {
438 return modem_messaging_client_.get();
441 NfcAdapterClient* FakeDBusThreadManager::GetNfcAdapterClient() {
442 return nfc_adapter_client_.get();
445 NfcDeviceClient* FakeDBusThreadManager::GetNfcDeviceClient() {
446 return nfc_device_client_.get();
449 NfcManagerClient* FakeDBusThreadManager::GetNfcManagerClient() {
450 return nfc_manager_client_.get();
453 NfcTagClient* FakeDBusThreadManager::GetNfcTagClient() {
454 return nfc_tag_client_.get();
457 NfcRecordClient* FakeDBusThreadManager::GetNfcRecordClient() {
458 return nfc_record_client_.get();
461 PermissionBrokerClient*
462 FakeDBusThreadManager::GetPermissionBrokerClient() {
463 return permission_broker_client_.get();
466 PowerManagerClient* FakeDBusThreadManager::GetPowerManagerClient() {
467 return power_manager_client_.get();
470 PowerPolicyController*
471 FakeDBusThreadManager::GetPowerPolicyController() {
472 return power_policy_controller_.get();
475 SessionManagerClient*
476 FakeDBusThreadManager::GetSessionManagerClient() {
477 return session_manager_client_.get();
480 SMSClient* FakeDBusThreadManager::GetSMSClient() {
481 return sms_client_.get();
484 SystemClockClient* FakeDBusThreadManager::GetSystemClockClient() {
485 return system_clock_client_.get();
488 UpdateEngineClient* FakeDBusThreadManager::GetUpdateEngineClient() {
489 return update_engine_client_.get();
492 } // namespace chromeos