- add sources.
[platform/framework/web/crosswalk.git] / src / chromeos / dbus / fake_dbus_thread_manager.h
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.
4
5 #ifndef CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_
6 #define CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_
7
8 #include <string>
9
10 #include "base/logging.h"
11 #include "base/observer_list.h"
12 #include "chromeos/dbus/dbus_thread_manager.h"
13
14 namespace dbus {
15 class Bus;
16 class ObjectPath;
17 }  // namespace dbus
18
19 namespace chromeos {
20
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;
41 class MockIBusClient;
42 class MockIBusEngineFactoryService;
43 class MockIBusEngineService;
44
45 // This class provides a fake implementation of DBusThreadManager, which
46 // hosts fake D-Bus clients.
47 class FakeDBusThreadManager : public DBusThreadManager {
48  public:
49   FakeDBusThreadManager();
50   virtual ~FakeDBusThreadManager();
51
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;
58
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;
96
97   FakeBluetoothAdapterClient* fake_bluetooth_adapter_client() {
98     return fake_bluetooth_adapter_client_.get();
99   }
100
101   FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client() {
102     return fake_bluetooth_agent_manager_client_.get();
103   }
104
105   FakeBluetoothDeviceClient* fake_bluetooth_device_client() {
106     return fake_bluetooth_device_client_.get();
107   }
108
109   FakeBluetoothInputClient* fake_bluetooth_input_client() {
110     return fake_bluetooth_input_client_.get();
111   }
112
113   FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client() {
114     return fake_bluetooth_profile_manager_client_.get();
115   }
116
117   FakeCrosDisksClient* fake_cros_disks_client() {
118     return fake_cros_disks_client_.get();
119   }
120
121   FakeCryptohomeClient* fake_cryptohome_client() {
122     return fake_cryptohome_client_.get();
123   }
124
125   FakeGsmSMSClient* fake_gsm_sms_client() {
126     return fake_gsm_sms_client_.get();
127   }
128
129   FakeImageBurnerClient* fake_image_burner_client() {
130     return fake_image_burner_client_.get();
131   }
132
133   FakeNfcAdapterClient* fake_nfc_adapter_client() {
134     return fake_nfc_adapter_client_.get();
135   }
136
137   FakeNfcDeviceClient* fake_nfc_device_client() {
138     return fake_nfc_device_client_.get();
139   }
140
141   FakeNfcManagerClient* fake_nfc_manager_client() {
142     return fake_nfc_manager_client_.get();
143   }
144
145   FakeNfcTagClient* fake_nfc_tag_client() {
146     return fake_nfc_tag_client_.get();
147   }
148
149   FakeSessionManagerClient* fake_session_manager_client() {
150     return fake_session_manager_client_.get();
151   }
152
153   FakeShillDeviceClient* fake_shill_device_client() {
154     return fake_shill_device_client_.get();
155   }
156
157   FakeShillManagerClient* fake_shill_manager_client() {
158     return fake_shill_manager_client_.get();
159   }
160
161   FakeSystemClockClient* fake_system_clock_client() {
162     return fake_system_clock_client_.get();
163   }
164
165   FakePowerManagerClient* fake_power_manager_client() {
166     return fake_power_manager_client_.get();
167   }
168
169   FakeUpdateEngineClient* fake_update_engine_client() {
170     return fake_update_engine_client_.get();
171   }
172
173   // TODO(komatsu): Remove IBus related code. crbug.com/275262
174   MockIBusClient* mock_ibus_client() {
175     return mock_ibus_client_.get();
176   }
177
178   MockIBusEngineService* mock_ibus_engine_service() {
179     return mock_ibus_engine_service_.get();
180   }
181
182   MockIBusEngineFactoryService* mock_ibus_engine_factory_service() {
183     return mock_ibus_engine_factory_service_.get();
184   }
185
186   void set_ibus_bus(dbus::Bus* ibus_bus) {
187     ibus_bus_ = ibus_bus;
188   }
189
190  private:
191   // Note: Keep this before other members so they can call AddObserver() in
192   // their c'tors.
193   ObserverList<DBusThreadManagerObserver> observers_;
194
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_;
216
217   scoped_ptr<MockIBusClient> mock_ibus_client_;
218   scoped_ptr<MockIBusEngineService> mock_ibus_engine_service_;
219   scoped_ptr<MockIBusEngineFactoryService> mock_ibus_engine_factory_service_;
220
221   scoped_ptr<PowerPolicyController> power_policy_controller_;
222   dbus::Bus* ibus_bus_;
223
224   DISALLOW_COPY_AND_ASSIGN(FakeDBusThreadManager);
225 };
226
227 }  // namespace chromeos
228
229 #endif  // CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_