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/dbus/dbus_thread_manager.h"
21 class DBusThreadManagerObserver;
22 class FakeBluetoothAdapterClient;
23 class FakeBluetoothAgentManagerClient;
24 class FakeBluetoothDeviceClient;
25 class FakeBluetoothInputClient;
26 class FakeBluetoothProfileManagerClient;
27 class FakeCrosDisksClient;
28 class FakeCryptohomeClient;
29 class FakeGsmSMSClient;
30 class FakeNfcAdapterClient;
31 class FakeNfcDeviceClient;
32 class FakeNfcManagerClient;
33 class FakeNfcTagClient;
34 class FakePowerManagerClient;
35 class FakeImageBurnerClient;
36 class FakeSessionManagerClient;
37 class FakeShillDeviceClient;
38 class FakeShillManagerClient;
39 class FakeSystemClockClient;
40 class FakeUpdateEngineClient;
42 class MockIBusEngineFactoryService;
43 class MockIBusEngineService;
45 // This class provides a fake implementation of DBusThreadManager, which
46 // hosts fake D-Bus clients.
47 class FakeDBusThreadManager : public DBusThreadManager {
49 FakeDBusThreadManager();
50 virtual ~FakeDBusThreadManager();
52 virtual void AddObserver(DBusThreadManagerObserver* observer) OVERRIDE;
53 virtual void RemoveObserver(DBusThreadManagerObserver* observer) OVERRIDE;
54 virtual void InitIBusBus(const std::string& ibus_address,
55 const base::Closure& closure) OVERRIDE;
56 virtual dbus::Bus* GetSystemBus() OVERRIDE;
57 virtual dbus::Bus* GetIBusBus() OVERRIDE;
59 virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE;
60 virtual BluetoothAgentManagerClient*
61 GetBluetoothAgentManagerClient() OVERRIDE;
62 virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE;
63 virtual BluetoothInputClient* GetBluetoothInputClient() OVERRIDE;
64 virtual BluetoothProfileManagerClient*
65 GetBluetoothProfileManagerClient() OVERRIDE;
66 virtual CrasAudioClient* GetCrasAudioClient() OVERRIDE;
67 virtual CrosDisksClient* GetCrosDisksClient() OVERRIDE;
68 virtual CryptohomeClient* GetCryptohomeClient() OVERRIDE;
69 virtual DebugDaemonClient* GetDebugDaemonClient() OVERRIDE;
70 virtual ShillDeviceClient* GetShillDeviceClient() OVERRIDE;
71 virtual ShillIPConfigClient* GetShillIPConfigClient() OVERRIDE;
72 virtual ShillManagerClient* GetShillManagerClient() OVERRIDE;
73 virtual ShillProfileClient* GetShillProfileClient() OVERRIDE;
74 virtual ShillServiceClient* GetShillServiceClient() OVERRIDE;
75 virtual GsmSMSClient* GetGsmSMSClient() OVERRIDE;
76 virtual ImageBurnerClient* GetImageBurnerClient() OVERRIDE;
77 virtual IntrospectableClient* GetIntrospectableClient() OVERRIDE;
78 virtual ModemMessagingClient* GetModemMessagingClient() OVERRIDE;
79 virtual NfcAdapterClient* GetNfcAdapterClient() OVERRIDE;
80 virtual NfcDeviceClient* GetNfcDeviceClient() OVERRIDE;
81 virtual NfcManagerClient* GetNfcManagerClient() OVERRIDE;
82 virtual NfcTagClient* GetNfcTagClient() OVERRIDE;
83 virtual PermissionBrokerClient* GetPermissionBrokerClient() OVERRIDE;
84 virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE;
85 virtual PowerPolicyController* GetPowerPolicyController() OVERRIDE;
86 virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE;
87 virtual SMSClient* GetSMSClient() OVERRIDE;
88 virtual SystemClockClient* GetSystemClockClient() OVERRIDE;
89 virtual UpdateEngineClient* GetUpdateEngineClient() OVERRIDE;
90 virtual IBusClient* GetIBusClient() OVERRIDE;
91 virtual IBusEngineFactoryService* GetIBusEngineFactoryService() OVERRIDE;
92 virtual IBusEngineService* GetIBusEngineService(
93 const dbus::ObjectPath& object_path) OVERRIDE;
94 virtual void RemoveIBusEngineService(
95 const dbus::ObjectPath& object_path) OVERRIDE;
97 FakeBluetoothAdapterClient* fake_bluetooth_adapter_client() {
98 return fake_bluetooth_adapter_client_.get();
101 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client() {
102 return fake_bluetooth_agent_manager_client_.get();
105 FakeBluetoothDeviceClient* fake_bluetooth_device_client() {
106 return fake_bluetooth_device_client_.get();
109 FakeBluetoothInputClient* fake_bluetooth_input_client() {
110 return fake_bluetooth_input_client_.get();
113 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client() {
114 return fake_bluetooth_profile_manager_client_.get();
117 FakeCrosDisksClient* fake_cros_disks_client() {
118 return fake_cros_disks_client_.get();
121 FakeCryptohomeClient* fake_cryptohome_client() {
122 return fake_cryptohome_client_.get();
125 FakeGsmSMSClient* fake_gsm_sms_client() {
126 return fake_gsm_sms_client_.get();
129 FakeImageBurnerClient* fake_image_burner_client() {
130 return fake_image_burner_client_.get();
133 FakeNfcAdapterClient* fake_nfc_adapter_client() {
134 return fake_nfc_adapter_client_.get();
137 FakeNfcDeviceClient* fake_nfc_device_client() {
138 return fake_nfc_device_client_.get();
141 FakeNfcManagerClient* fake_nfc_manager_client() {
142 return fake_nfc_manager_client_.get();
145 FakeNfcTagClient* fake_nfc_tag_client() {
146 return fake_nfc_tag_client_.get();
149 FakeSessionManagerClient* fake_session_manager_client() {
150 return fake_session_manager_client_.get();
153 FakeShillDeviceClient* fake_shill_device_client() {
154 return fake_shill_device_client_.get();
157 FakeShillManagerClient* fake_shill_manager_client() {
158 return fake_shill_manager_client_.get();
161 FakeSystemClockClient* fake_system_clock_client() {
162 return fake_system_clock_client_.get();
165 FakePowerManagerClient* fake_power_manager_client() {
166 return fake_power_manager_client_.get();
169 FakeUpdateEngineClient* fake_update_engine_client() {
170 return fake_update_engine_client_.get();
173 // TODO(komatsu): Remove IBus related code. crbug.com/275262
174 MockIBusClient* mock_ibus_client() {
175 return mock_ibus_client_.get();
178 MockIBusEngineService* mock_ibus_engine_service() {
179 return mock_ibus_engine_service_.get();
182 MockIBusEngineFactoryService* mock_ibus_engine_factory_service() {
183 return mock_ibus_engine_factory_service_.get();
186 void set_ibus_bus(dbus::Bus* ibus_bus) {
187 ibus_bus_ = ibus_bus;
191 // Note: Keep this before other members so they can call AddObserver() in
193 ObserverList<DBusThreadManagerObserver> observers_;
195 scoped_ptr<FakeBluetoothAdapterClient> fake_bluetooth_adapter_client_;
196 scoped_ptr<FakeBluetoothAgentManagerClient>
197 fake_bluetooth_agent_manager_client_;
198 scoped_ptr<FakeBluetoothDeviceClient> fake_bluetooth_device_client_;
199 scoped_ptr<FakeBluetoothInputClient> fake_bluetooth_input_client_;
200 scoped_ptr<FakeBluetoothProfileManagerClient>
201 fake_bluetooth_profile_manager_client_;
202 scoped_ptr<FakeCrosDisksClient> fake_cros_disks_client_;
203 scoped_ptr<FakeCryptohomeClient> fake_cryptohome_client_;
204 scoped_ptr<FakeGsmSMSClient> fake_gsm_sms_client_;
205 scoped_ptr<FakeImageBurnerClient> fake_image_burner_client_;
206 scoped_ptr<FakeNfcAdapterClient> fake_nfc_adapter_client_;
207 scoped_ptr<FakeNfcDeviceClient> fake_nfc_device_client_;
208 scoped_ptr<FakeNfcManagerClient> fake_nfc_manager_client_;
209 scoped_ptr<FakeNfcTagClient> fake_nfc_tag_client_;
210 scoped_ptr<FakeSessionManagerClient> fake_session_manager_client_;
211 scoped_ptr<FakeShillDeviceClient> fake_shill_device_client_;
212 scoped_ptr<FakeShillManagerClient> fake_shill_manager_client_;
213 scoped_ptr<FakeSystemClockClient> fake_system_clock_client_;
214 scoped_ptr<FakePowerManagerClient> fake_power_manager_client_;
215 scoped_ptr<FakeUpdateEngineClient> fake_update_engine_client_;
217 scoped_ptr<MockIBusClient> mock_ibus_client_;
218 scoped_ptr<MockIBusEngineService> mock_ibus_engine_service_;
219 scoped_ptr<MockIBusEngineFactoryService> mock_ibus_engine_factory_service_;
221 scoped_ptr<PowerPolicyController> power_policy_controller_;
222 dbus::Bus* ibus_bus_;
224 DISALLOW_COPY_AND_ASSIGN(FakeDBusThreadManager);
227 } // namespace chromeos
229 #endif // CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_