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_MOCK_DBUS_THREAD_MANAGER_WITHOUT_GMOCK_H_
6 #define CHROMEOS_DBUS_MOCK_DBUS_THREAD_MANAGER_WITHOUT_GMOCK_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 FakePowerManagerClient
;
31 class FakeImageBurnerClient
;
32 class FakeSessionManagerClient
;
33 class FakeShillManagerClient
;
34 class FakeSystemClockClient
;
35 class FakeUpdateEngineClient
;
37 class MockIBusConfigClient
;
38 class MockIBusEngineFactoryService
;
39 class MockIBusEngineService
;
40 class MockIBusInputContextClient
;
41 class MockIBusPanelService
;
43 // This class provides an another mock DBusThreadManager without gmock
44 // dependency. This class is used for places where GMock is not allowed
45 // (ex. ui/) or is not used.
46 // TODO(haruki): Along with crbug.com/223061, we can rename this class to
47 // clarify that this can also provides fakes and stubs.
48 class MockDBusThreadManagerWithoutGMock
: public DBusThreadManager
{
50 MockDBusThreadManagerWithoutGMock();
51 virtual ~MockDBusThreadManagerWithoutGMock();
53 virtual void AddObserver(DBusThreadManagerObserver
* observer
) OVERRIDE
;
54 virtual void RemoveObserver(DBusThreadManagerObserver
* observer
) OVERRIDE
;
55 virtual void InitIBusBus(const std::string
& ibus_address
,
56 const base::Closure
& closure
) OVERRIDE
;
57 virtual dbus::Bus
* GetSystemBus() OVERRIDE
;
58 virtual dbus::Bus
* GetIBusBus() OVERRIDE
;
60 virtual CrasAudioClient
* GetCrasAudioClient() OVERRIDE
;
61 virtual CrosDisksClient
* GetCrosDisksClient() OVERRIDE
;
62 virtual CryptohomeClient
* GetCryptohomeClient() OVERRIDE
;
63 virtual DebugDaemonClient
* GetDebugDaemonClient() OVERRIDE
;
64 virtual ExperimentalBluetoothAdapterClient
*
65 GetExperimentalBluetoothAdapterClient() OVERRIDE
;
66 virtual ExperimentalBluetoothAgentManagerClient
*
67 GetExperimentalBluetoothAgentManagerClient() OVERRIDE
;
68 virtual ExperimentalBluetoothDeviceClient
*
69 GetExperimentalBluetoothDeviceClient() OVERRIDE
;
70 virtual ExperimentalBluetoothInputClient
*
71 GetExperimentalBluetoothInputClient() OVERRIDE
;
72 virtual ExperimentalBluetoothProfileManagerClient
*
73 GetExperimentalBluetoothProfileManagerClient() OVERRIDE
;
74 virtual ShillDeviceClient
* GetShillDeviceClient() OVERRIDE
;
75 virtual ShillIPConfigClient
* GetShillIPConfigClient() OVERRIDE
;
76 virtual ShillManagerClient
* GetShillManagerClient() OVERRIDE
;
77 virtual ShillProfileClient
* GetShillProfileClient() OVERRIDE
;
78 virtual ShillServiceClient
* GetShillServiceClient() OVERRIDE
;
79 virtual GsmSMSClient
* GetGsmSMSClient() OVERRIDE
;
80 virtual ImageBurnerClient
* GetImageBurnerClient() OVERRIDE
;
81 virtual IntrospectableClient
* GetIntrospectableClient() OVERRIDE
;
82 virtual ModemMessagingClient
* GetModemMessagingClient() 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 IBusConfigClient
* GetIBusConfigClient() OVERRIDE
;
92 virtual IBusInputContextClient
* GetIBusInputContextClient() OVERRIDE
;
93 virtual IBusEngineFactoryService
* GetIBusEngineFactoryService() OVERRIDE
;
94 virtual IBusEngineService
* GetIBusEngineService(
95 const dbus::ObjectPath
& object_path
) OVERRIDE
;
96 virtual void RemoveIBusEngineService(
97 const dbus::ObjectPath
& object_path
) OVERRIDE
;
98 virtual IBusPanelService
* GetIBusPanelService() OVERRIDE
;
100 FakeBluetoothAdapterClient
* fake_bluetooth_adapter_client() {
101 return fake_bluetooth_adapter_client_
.get();
104 FakeBluetoothAgentManagerClient
* fake_bluetooth_agent_manager_client() {
105 return fake_bluetooth_agent_manager_client_
.get();
108 FakeBluetoothDeviceClient
* fake_bluetooth_device_client() {
109 return fake_bluetooth_device_client_
.get();
112 FakeBluetoothInputClient
* fake_bluetooth_input_client() {
113 return fake_bluetooth_input_client_
.get();
116 FakeBluetoothProfileManagerClient
* fake_bluetooth_profile_manager_client() {
117 return fake_bluetooth_profile_manager_client_
.get();
120 FakeCrosDisksClient
* fake_cros_disks_client() {
121 return fake_cros_disks_client_
.get();
124 FakeCryptohomeClient
* fake_cryptohome_client() {
125 return fake_cryptohome_client_
.get();
128 FakeGsmSMSClient
* fake_gsm_sms_client() {
129 return fake_gsm_sms_client_
.get();
132 FakeImageBurnerClient
* fake_image_burner_client() {
133 return fake_image_burner_client_
.get();
136 FakeSessionManagerClient
* fake_session_manager_client() {
137 return fake_session_manager_client_
.get();
140 FakeShillManagerClient
* fake_shill_manager_client() {
141 return fake_shill_manager_client_
.get();
144 FakeSystemClockClient
* fake_system_clock_client() {
145 return fake_system_clock_client_
.get();
148 FakePowerManagerClient
* fake_power_manager_client() {
149 return fake_power_manager_client_
.get();
152 FakeUpdateEngineClient
* fake_update_engine_client() {
153 return fake_update_engine_client_
.get();
156 MockIBusClient
* mock_ibus_client() {
157 return mock_ibus_client_
.get();
160 MockIBusConfigClient
* mock_ibus_config_client() {
161 return mock_ibus_config_client_
.get();
164 MockIBusInputContextClient
* mock_ibus_input_context_client() {
165 return mock_ibus_input_context_client_
.get();
168 MockIBusEngineService
* mock_ibus_engine_service() {
169 return mock_ibus_engine_service_
.get();
172 MockIBusEngineFactoryService
* mock_ibus_engine_factory_service() {
173 return mock_ibus_engine_factory_service_
.get();
176 MockIBusPanelService
* mock_ibus_panel_service() {
177 return mock_ibus_panel_service_
.get();
180 void set_ibus_bus(dbus::Bus
* ibus_bus
) {
181 ibus_bus_
= ibus_bus
;
185 // Note: Keep this before other members so they can call AddObserver() in
187 ObserverList
<DBusThreadManagerObserver
> observers_
;
189 // These fake_bluetooth_*_client_ are for ExperimentalBluetooth*Client.
190 scoped_ptr
<FakeBluetoothAdapterClient
> fake_bluetooth_adapter_client_
;
191 scoped_ptr
<FakeBluetoothAgentManagerClient
>
192 fake_bluetooth_agent_manager_client_
;
193 scoped_ptr
<FakeBluetoothDeviceClient
> fake_bluetooth_device_client_
;
194 scoped_ptr
<FakeBluetoothInputClient
> fake_bluetooth_input_client_
;
195 scoped_ptr
<FakeBluetoothProfileManagerClient
>
196 fake_bluetooth_profile_manager_client_
;
197 scoped_ptr
<FakeCrosDisksClient
> fake_cros_disks_client_
;
198 scoped_ptr
<FakeCryptohomeClient
> fake_cryptohome_client_
;
199 scoped_ptr
<FakeGsmSMSClient
> fake_gsm_sms_client_
;
200 scoped_ptr
<FakeImageBurnerClient
> fake_image_burner_client_
;
201 scoped_ptr
<FakeSessionManagerClient
> fake_session_manager_client_
;
202 scoped_ptr
<FakeShillManagerClient
> fake_shill_manager_client_
;
203 scoped_ptr
<FakeSystemClockClient
> fake_system_clock_client_
;
204 scoped_ptr
<FakePowerManagerClient
> fake_power_manager_client_
;
205 scoped_ptr
<FakeUpdateEngineClient
> fake_update_engine_client_
;
207 scoped_ptr
<MockIBusClient
> mock_ibus_client_
;
208 scoped_ptr
<MockIBusConfigClient
> mock_ibus_config_client_
;
209 scoped_ptr
<MockIBusInputContextClient
> mock_ibus_input_context_client_
;
210 scoped_ptr
<MockIBusEngineService
> mock_ibus_engine_service_
;
211 scoped_ptr
<MockIBusEngineFactoryService
> mock_ibus_engine_factory_service_
;
212 scoped_ptr
<MockIBusPanelService
> mock_ibus_panel_service_
;
214 scoped_ptr
<PowerPolicyController
> power_policy_controller_
;
215 dbus::Bus
* ibus_bus_
;
217 DISALLOW_COPY_AND_ASSIGN(MockDBusThreadManagerWithoutGMock
);
220 } // namespace chromeos
222 #endif // CHROMEOS_DBUS_MOCK_DBUS_THREAD_MANAGER_WITHOUT_GMOCK_H_