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 #ifndef CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_
6 #define CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_
10 #include "base/logging.h"
11 #include "base/observer_list.h"
12 #include "chromeos/chromeos_export.h"
13 #include "chromeos/dbus/dbus_thread_manager.h"
22 class DBusThreadManagerObserver
;
24 // This class provides a fake implementation of DBusThreadManager, which
25 // hosts fake D-Bus clients.
26 class CHROMEOS_EXPORT FakeDBusThreadManager
: public DBusThreadManager
{
28 FakeDBusThreadManager();
29 virtual ~FakeDBusThreadManager();
31 // Creates and sets all fake DBusClients and the PowerPolicyController.
32 void SetFakeClients();
34 // Creates and sets all fake Shill DBusClients.
35 void SetFakeShillClients();
37 // Sets up any default environment for fake clients, e.g. for UI testing.
38 void SetupDefaultEnvironment();
40 void SetBluetoothAdapterClient(scoped_ptr
<BluetoothAdapterClient
> client
);
41 void SetBluetoothAgentManagerClient(
42 scoped_ptr
<BluetoothAgentManagerClient
> client
);
43 void SetBluetoothDeviceClient(scoped_ptr
<BluetoothDeviceClient
> client
);
44 void SetBluetoothGattCharacteristicClient(
45 scoped_ptr
<BluetoothGattCharacteristicClient
> client
);
46 void SetBluetoothGattDescriptorClient(
47 scoped_ptr
<BluetoothGattDescriptorClient
> client
);
48 void SetBluetoothGattManagerClient(
49 scoped_ptr
<BluetoothGattManagerClient
> client
);
50 void SetBluetoothGattServiceClient(
51 scoped_ptr
<BluetoothGattServiceClient
> client
);
52 void SetBluetoothInputClient(scoped_ptr
<BluetoothInputClient
> client
);
53 void SetBluetoothProfileManagerClient(
54 scoped_ptr
<BluetoothProfileManagerClient
> client
);
55 void SetCrasAudioClient(scoped_ptr
<CrasAudioClient
> client
);
56 void SetCrosDisksClient(scoped_ptr
<CrosDisksClient
> client
);
57 void SetCryptohomeClient(scoped_ptr
<CryptohomeClient
> client
);
58 void SetDebugDaemonClient(scoped_ptr
<DebugDaemonClient
> client
);
59 void SetLorgnetteManagerClient(scoped_ptr
<LorgnetteManagerClient
> client
);
60 void SetShillDeviceClient(scoped_ptr
<ShillDeviceClient
> client
);
61 void SetShillIPConfigClient(scoped_ptr
<ShillIPConfigClient
> client
);
62 void SetShillManagerClient(scoped_ptr
<ShillManagerClient
> client
);
63 void SetShillServiceClient(scoped_ptr
<ShillServiceClient
> client
);
64 void SetShillProfileClient(scoped_ptr
<ShillProfileClient
> client
);
65 void SetGsmSMSClient(scoped_ptr
<GsmSMSClient
> client
);
66 void SetImageBurnerClient(scoped_ptr
<ImageBurnerClient
> client
);
67 void SetIntrospectableClient(scoped_ptr
<IntrospectableClient
> client
);
68 void SetModemMessagingClient(scoped_ptr
<ModemMessagingClient
> client
);
69 void SetNfcAdapterClient(scoped_ptr
<NfcAdapterClient
> client
);
70 void SetNfcDeviceClient(scoped_ptr
<NfcDeviceClient
> client
);
71 void SetNfcManagerClient(scoped_ptr
<NfcManagerClient
> client
);
72 void SetNfcRecordClient(scoped_ptr
<NfcRecordClient
> client
);
73 void SetNfcTagClient(scoped_ptr
<NfcTagClient
> client
);
74 void SetPermissionBrokerClient(scoped_ptr
<PermissionBrokerClient
> client
);
75 void SetPowerManagerClient(scoped_ptr
<PowerManagerClient
> client
);
76 void SetPowerPolicyController(scoped_ptr
<PowerPolicyController
> client
);
77 void SetSessionManagerClient(scoped_ptr
<SessionManagerClient
> client
);
78 void SetSMSClient(scoped_ptr
<SMSClient
> client
);
79 void SetSystemClockClient(scoped_ptr
<SystemClockClient
> client
);
80 void SetUpdateEngineClient(scoped_ptr
<UpdateEngineClient
> client
);
82 virtual void AddObserver(DBusThreadManagerObserver
* observer
) OVERRIDE
;
83 virtual void RemoveObserver(DBusThreadManagerObserver
* observer
) OVERRIDE
;
84 virtual dbus::Bus
* GetSystemBus() OVERRIDE
;
86 virtual BluetoothAdapterClient
* GetBluetoothAdapterClient() OVERRIDE
;
87 virtual BluetoothAgentManagerClient
*
88 GetBluetoothAgentManagerClient() OVERRIDE
;
89 virtual BluetoothDeviceClient
* GetBluetoothDeviceClient() OVERRIDE
;
90 virtual BluetoothGattCharacteristicClient
*
91 GetBluetoothGattCharacteristicClient() OVERRIDE
;
92 virtual BluetoothGattDescriptorClient
*
93 GetBluetoothGattDescriptorClient() OVERRIDE
;
94 virtual BluetoothGattManagerClient
* GetBluetoothGattManagerClient() OVERRIDE
;
95 virtual BluetoothGattServiceClient
* GetBluetoothGattServiceClient() OVERRIDE
;
96 virtual BluetoothInputClient
* GetBluetoothInputClient() OVERRIDE
;
97 virtual BluetoothProfileManagerClient
*
98 GetBluetoothProfileManagerClient() OVERRIDE
;
99 virtual CrasAudioClient
* GetCrasAudioClient() OVERRIDE
;
100 virtual CrosDisksClient
* GetCrosDisksClient() OVERRIDE
;
101 virtual CryptohomeClient
* GetCryptohomeClient() OVERRIDE
;
102 virtual DebugDaemonClient
* GetDebugDaemonClient() OVERRIDE
;
103 virtual LorgnetteManagerClient
* GetLorgnetteManagerClient() OVERRIDE
;
104 virtual ShillDeviceClient
* GetShillDeviceClient() OVERRIDE
;
105 virtual ShillIPConfigClient
* GetShillIPConfigClient() OVERRIDE
;
106 virtual ShillManagerClient
* GetShillManagerClient() OVERRIDE
;
107 virtual ShillProfileClient
* GetShillProfileClient() OVERRIDE
;
108 virtual ShillServiceClient
* GetShillServiceClient() OVERRIDE
;
109 virtual GsmSMSClient
* GetGsmSMSClient() OVERRIDE
;
110 virtual ImageBurnerClient
* GetImageBurnerClient() OVERRIDE
;
111 virtual IntrospectableClient
* GetIntrospectableClient() OVERRIDE
;
112 virtual ModemMessagingClient
* GetModemMessagingClient() OVERRIDE
;
113 virtual NfcAdapterClient
* GetNfcAdapterClient() OVERRIDE
;
114 virtual NfcDeviceClient
* GetNfcDeviceClient() OVERRIDE
;
115 virtual NfcManagerClient
* GetNfcManagerClient() OVERRIDE
;
116 virtual NfcRecordClient
* GetNfcRecordClient() OVERRIDE
;
117 virtual NfcTagClient
* GetNfcTagClient() OVERRIDE
;
118 virtual PermissionBrokerClient
* GetPermissionBrokerClient() OVERRIDE
;
119 virtual PowerManagerClient
* GetPowerManagerClient() OVERRIDE
;
120 virtual PowerPolicyController
* GetPowerPolicyController() OVERRIDE
;
121 virtual SessionManagerClient
* GetSessionManagerClient() OVERRIDE
;
122 virtual SMSClient
* GetSMSClient() OVERRIDE
;
123 virtual SystemClockClient
* GetSystemClockClient() OVERRIDE
;
124 virtual UpdateEngineClient
* GetUpdateEngineClient() OVERRIDE
;
127 // Note: Keep this before other members so they can call AddObserver() in
129 ObserverList
<DBusThreadManagerObserver
> observers_
;
131 scoped_ptr
<BluetoothAdapterClient
> bluetooth_adapter_client_
;
132 scoped_ptr
<BluetoothAgentManagerClient
> bluetooth_agent_manager_client_
;
133 scoped_ptr
<BluetoothDeviceClient
> bluetooth_device_client_
;
134 scoped_ptr
<BluetoothGattCharacteristicClient
>
135 bluetooth_gatt_characteristic_client_
;
136 scoped_ptr
<BluetoothGattDescriptorClient
>
137 bluetooth_gatt_descriptor_client_
;
138 scoped_ptr
<BluetoothGattManagerClient
> bluetooth_gatt_manager_client_
;
139 scoped_ptr
<BluetoothGattServiceClient
> bluetooth_gatt_service_client_
;
140 scoped_ptr
<BluetoothInputClient
> bluetooth_input_client_
;
141 scoped_ptr
<BluetoothProfileManagerClient
> bluetooth_profile_manager_client_
;
142 scoped_ptr
<CrasAudioClient
> cras_audio_client_
;
143 scoped_ptr
<CrosDisksClient
> cros_disks_client_
;
144 scoped_ptr
<CryptohomeClient
> cryptohome_client_
;
145 scoped_ptr
<DebugDaemonClient
> debug_daemon_client_
;
146 scoped_ptr
<LorgnetteManagerClient
> lorgnette_manager_client_
;
147 scoped_ptr
<ShillDeviceClient
> shill_device_client_
;
148 scoped_ptr
<ShillIPConfigClient
> shill_ipconfig_client_
;
149 scoped_ptr
<ShillManagerClient
> shill_manager_client_
;
150 scoped_ptr
<ShillServiceClient
> shill_service_client_
;
151 scoped_ptr
<ShillProfileClient
> shill_profile_client_
;
152 scoped_ptr
<GsmSMSClient
> gsm_sms_client_
;
153 scoped_ptr
<ImageBurnerClient
> image_burner_client_
;
154 scoped_ptr
<IntrospectableClient
> introspectable_client_
;
155 scoped_ptr
<ModemMessagingClient
> modem_messaging_client_
;
156 scoped_ptr
<NfcAdapterClient
> nfc_adapter_client_
;
157 scoped_ptr
<NfcDeviceClient
> nfc_device_client_
;
158 scoped_ptr
<NfcManagerClient
> nfc_manager_client_
;
159 scoped_ptr
<NfcRecordClient
> nfc_record_client_
;
160 scoped_ptr
<NfcTagClient
> nfc_tag_client_
;
161 scoped_ptr
<PermissionBrokerClient
> permission_broker_client_
;
162 scoped_ptr
<SystemClockClient
> system_clock_client_
;
163 scoped_ptr
<PowerManagerClient
> power_manager_client_
;
164 scoped_ptr
<SessionManagerClient
> session_manager_client_
;
165 scoped_ptr
<SMSClient
> sms_client_
;
166 scoped_ptr
<UpdateEngineClient
> update_engine_client_
;
168 scoped_ptr
<PowerPolicyController
> power_policy_controller_
;
170 DISALLOW_COPY_AND_ASSIGN(FakeDBusThreadManager
);
173 } // namespace chromeos
175 #endif // CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_