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_H_
6 #define CHROMEOS_DBUS_MOCK_DBUS_THREAD_MANAGER_H_
10 #include "base/observer_list.h"
11 #include "chromeos/dbus/dbus_thread_manager.h"
12 #include "testing/gmock/include/gmock/gmock.h"
22 class DBusThreadManagerObserver
;
23 class FakeBluetoothAdapterClient
;
24 class FakeBluetoothAgentManagerClient
;
25 class FakeBluetoothDeviceClient
;
26 class FakeBluetoothInputClient
;
27 class FakeBluetoothProfileManagerClient
;
28 class MockCryptohomeClient
;
29 class MockShillDeviceClient
;
30 class MockShillIPConfigClient
;
31 class MockShillManagerClient
;
32 class MockShillProfileClient
;
33 class MockShillServiceClient
;
34 class MockGsmSMSClient
;
35 class MockPowerManagerClient
;
36 class MockSessionManagerClient
;
38 // This class provides a mock DBusThreadManager with mock clients
39 // installed. You can customize the behaviors of mock clients with
40 // mock_foo_client() functions.
41 // Please avoid adding more GMock in this class. We have an ongoing effort to
42 // remove GMock dependency. TODO(haruki): crbug.com/223061.
43 class MockDBusThreadManager
: public DBusThreadManager
{
45 MockDBusThreadManager();
46 virtual ~MockDBusThreadManager();
48 void AddObserver(DBusThreadManagerObserver
* observer
) OVERRIDE
;
49 void RemoveObserver(DBusThreadManagerObserver
* observer
) OVERRIDE
;
50 MOCK_METHOD2(InitIBusBus
, void(const std::string
& ibus_address
,
51 const base::Closure
& closure
));
52 MOCK_METHOD0(GetSystemBus
, dbus::Bus
*(void));
53 MOCK_METHOD0(GetIBusBus
, dbus::Bus
*(void));
54 MOCK_METHOD0(GetBluetoothAdapterClient
, BluetoothAdapterClient
*(void));
55 MOCK_METHOD0(GetBluetoothAgentManagerClient
,
56 BluetoothAgentManagerClient
*(void));
57 MOCK_METHOD0(GetBluetoothDeviceClient
, BluetoothDeviceClient
*(void));
58 MOCK_METHOD0(GetBluetoothInputClient
, BluetoothInputClient
*(void));
59 MOCK_METHOD0(GetBluetoothProfileManagerClient
,
60 BluetoothProfileManagerClient
*(void));
61 MOCK_METHOD0(GetCrasAudioClient
, CrasAudioClient
*(void));
62 MOCK_METHOD0(GetCrosDisksClient
, CrosDisksClient
*(void));
63 MOCK_METHOD0(GetCryptohomeClient
, CryptohomeClient
*(void));
64 MOCK_METHOD0(GetDebugDaemonClient
, DebugDaemonClient
*(void));
65 MOCK_METHOD0(GetShillDeviceClient
, ShillDeviceClient
*(void));
66 MOCK_METHOD0(GetShillIPConfigClient
, ShillIPConfigClient
*(void));
67 MOCK_METHOD0(GetShillManagerClient
, ShillManagerClient
*(void));
68 MOCK_METHOD0(GetShillProfileClient
, ShillProfileClient
*(void));
69 MOCK_METHOD0(GetShillServiceClient
, ShillServiceClient
*(void));
70 MOCK_METHOD0(GetGsmSMSClient
, GsmSMSClient
*(void));
71 MOCK_METHOD0(GetImageBurnerClient
, ImageBurnerClient
*(void));
72 MOCK_METHOD0(GetIntrospectableClient
, IntrospectableClient
*(void));
73 MOCK_METHOD0(GetModemMessagingClient
, ModemMessagingClient
*(void));
74 MOCK_METHOD0(GetPermissionBrokerClient
, PermissionBrokerClient
*(void));
75 MOCK_METHOD0(GetPowerManagerClient
, PowerManagerClient
*(void));
76 MOCK_METHOD0(GetPowerPolicyController
, PowerPolicyController
*(void));
77 MOCK_METHOD0(GetSessionManagerClient
, SessionManagerClient
*(void));
78 MOCK_METHOD0(GetSMSClient
, SMSClient
*(void));
79 MOCK_METHOD0(GetSystemClockClient
, SystemClockClient
*(void));
80 MOCK_METHOD0(GetUpdateEngineClient
, UpdateEngineClient
*(void));
81 MOCK_METHOD0(GetIBusClient
, IBusClient
*(void));
82 MOCK_METHOD0(GetIBusConfigClient
, IBusConfigClient
*(void));
83 MOCK_METHOD0(GetIBusInputContextClient
, IBusInputContextClient
*(void));
84 MOCK_METHOD0(GetIBusEngineFactoryService
, IBusEngineFactoryService
*(void));
85 MOCK_METHOD1(GetIBusEngineService
,
86 IBusEngineService
*(const dbus::ObjectPath
& object_path
));
87 MOCK_METHOD1(RemoveIBusEngineService
,
88 void(const dbus::ObjectPath
& object_path
));
89 MOCK_METHOD0(GetIBusPanelService
, IBusPanelService
*(void));
91 FakeBluetoothAdapterClient
* fake_bluetooth_adapter_client() {
92 return fake_bluetooth_adapter_client_
.get();
94 FakeBluetoothAgentManagerClient
* fake_bluetooth_agent_manager_client() {
95 return fake_bluetooth_agent_manager_client_
.get();
97 FakeBluetoothDeviceClient
* fake_bluetooth_device_client() {
98 return fake_bluetooth_device_client_
.get();
100 FakeBluetoothInputClient
* fake_bluetooth_input_client() {
101 return fake_bluetooth_input_client_
.get();
103 FakeBluetoothProfileManagerClient
* fake_bluetooth_profile_manager_client() {
104 return fake_bluetooth_profile_manager_client_
.get();
106 MockCryptohomeClient
* mock_cryptohome_client() {
107 return mock_cryptohome_client_
.get();
109 MockShillDeviceClient
* mock_shill_device_client() {
110 return mock_shill_device_client_
.get();
112 MockShillIPConfigClient
* mock_shill_ipconfig_client() {
113 return mock_shill_ipconfig_client_
.get();
115 MockShillManagerClient
* mock_shill_manager_client() {
116 return mock_shill_manager_client_
.get();
118 MockShillProfileClient
* mock_shill_profile_client() {
119 return mock_shill_profile_client_
.get();
121 MockShillServiceClient
* mock_shill_service_client() {
122 return mock_shill_service_client_
.get();
124 MockGsmSMSClient
* mock_gsm_sms_client() {
125 return mock_gsm_sms_client_
.get();
127 MockSessionManagerClient
* mock_session_manager_client() {
128 return mock_session_manager_client_
.get();
132 // Note: Keep this before other members so they can call AddObserver() in
134 ObserverList
<DBusThreadManagerObserver
> observers_
;
136 scoped_ptr
<FakeBluetoothAdapterClient
> fake_bluetooth_adapter_client_
;
137 scoped_ptr
<FakeBluetoothAgentManagerClient
>
138 fake_bluetooth_agent_manager_client_
;
139 scoped_ptr
<FakeBluetoothDeviceClient
> fake_bluetooth_device_client_
;
140 scoped_ptr
<FakeBluetoothInputClient
> fake_bluetooth_input_client_
;
141 scoped_ptr
<FakeBluetoothProfileManagerClient
>
142 fake_bluetooth_profile_manager_client_
;
143 scoped_ptr
<MockCryptohomeClient
> mock_cryptohome_client_
;
144 scoped_ptr
<MockShillDeviceClient
> mock_shill_device_client_
;
145 scoped_ptr
<MockShillIPConfigClient
> mock_shill_ipconfig_client_
;
146 scoped_ptr
<MockShillManagerClient
> mock_shill_manager_client_
;
147 scoped_ptr
<MockShillProfileClient
> mock_shill_profile_client_
;
148 scoped_ptr
<MockShillServiceClient
> mock_shill_service_client_
;
149 scoped_ptr
<MockGsmSMSClient
> mock_gsm_sms_client_
;
150 scoped_ptr
<MockSessionManagerClient
> mock_session_manager_client_
;
152 DISALLOW_COPY_AND_ASSIGN(MockDBusThreadManager
);
155 } // namespace chromeos
157 #endif // CHROMEOS_DBUS_MOCK_DBUS_THREAD_MANAGER_H_