OLD | NEW |
| (Empty) |
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_MOCK_DBUS_THREAD_MANAGER_H_ | |
6 #define CHROMEOS_DBUS_MOCK_DBUS_THREAD_MANAGER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/observer_list.h" | |
11 #include "chromeos/dbus/dbus_thread_manager.h" | |
12 #include "testing/gmock/include/gmock/gmock.h" | |
13 | |
14 namespace dbus { | |
15 | |
16 class Bus; | |
17 | |
18 } // namespace dbus | |
19 | |
20 namespace chromeos { | |
21 | |
22 class DBusThreadManagerObserver; | |
23 class FakeBluetoothAdapterClient; | |
24 class FakeBluetoothAgentManagerClient; | |
25 class FakeBluetoothDeviceClient; | |
26 class FakeBluetoothInputClient; | |
27 class FakeBluetoothProfileManagerClient; | |
28 class FakeGsmSMSClient; | |
29 class FakeNfcAdapterClient; | |
30 class FakeNfcDeviceClient; | |
31 class FakeNfcManagerClient; | |
32 class FakeNfcTagClient; | |
33 class FakeShillDeviceClient; | |
34 class FakeShillIPConfigClient; | |
35 class MockCryptohomeClient; | |
36 class MockPowerManagerClient; | |
37 class MockSessionManagerClient; | |
38 class MockShillManagerClient; | |
39 class MockShillProfileClient; | |
40 class MockShillServiceClient; | |
41 | |
42 // This class provides a mock DBusThreadManager with mock clients | |
43 // installed. You can customize the behaviors of mock clients with | |
44 // mock_foo_client() functions. | |
45 // Please avoid adding more GMock in this class. We have an ongoing effort to | |
46 // remove GMock dependency. TODO(haruki): crbug.com/223061. | |
47 class MockDBusThreadManager : public DBusThreadManager { | |
48 public: | |
49 MockDBusThreadManager(); | |
50 virtual ~MockDBusThreadManager(); | |
51 | |
52 void AddObserver(DBusThreadManagerObserver* observer) OVERRIDE; | |
53 void RemoveObserver(DBusThreadManagerObserver* observer) OVERRIDE; | |
54 MOCK_METHOD2(InitIBusBus, void(const std::string& ibus_address, | |
55 const base::Closure& closure)); | |
56 MOCK_METHOD0(GetSystemBus, dbus::Bus*(void)); | |
57 MOCK_METHOD0(GetBluetoothAdapterClient, BluetoothAdapterClient*(void)); | |
58 MOCK_METHOD0(GetBluetoothAgentManagerClient, | |
59 BluetoothAgentManagerClient*(void)); | |
60 MOCK_METHOD0(GetBluetoothDeviceClient, BluetoothDeviceClient*(void)); | |
61 MOCK_METHOD0(GetBluetoothInputClient, BluetoothInputClient*(void)); | |
62 MOCK_METHOD0(GetBluetoothProfileManagerClient, | |
63 BluetoothProfileManagerClient*(void)); | |
64 MOCK_METHOD0(GetCrasAudioClient, CrasAudioClient*(void)); | |
65 MOCK_METHOD0(GetCrosDisksClient, CrosDisksClient*(void)); | |
66 MOCK_METHOD0(GetCryptohomeClient, CryptohomeClient*(void)); | |
67 MOCK_METHOD0(GetDebugDaemonClient, DebugDaemonClient*(void)); | |
68 MOCK_METHOD0(GetShillDeviceClient, ShillDeviceClient*(void)); | |
69 MOCK_METHOD0(GetShillIPConfigClient, ShillIPConfigClient*(void)); | |
70 MOCK_METHOD0(GetShillManagerClient, ShillManagerClient*(void)); | |
71 MOCK_METHOD0(GetShillProfileClient, ShillProfileClient*(void)); | |
72 MOCK_METHOD0(GetShillServiceClient, ShillServiceClient*(void)); | |
73 MOCK_METHOD0(GetGsmSMSClient, GsmSMSClient*(void)); | |
74 MOCK_METHOD0(GetImageBurnerClient, ImageBurnerClient*(void)); | |
75 MOCK_METHOD0(GetIntrospectableClient, IntrospectableClient*(void)); | |
76 MOCK_METHOD0(GetModemMessagingClient, ModemMessagingClient*(void)); | |
77 MOCK_METHOD0(GetNfcAdapterClient, NfcAdapterClient*(void)); | |
78 MOCK_METHOD0(GetNfcDeviceClient, NfcDeviceClient*(void)); | |
79 MOCK_METHOD0(GetNfcManagerClient, NfcManagerClient*(void)); | |
80 MOCK_METHOD0(GetNfcTagClient, NfcTagClient*(void)); | |
81 MOCK_METHOD0(GetPermissionBrokerClient, PermissionBrokerClient*(void)); | |
82 MOCK_METHOD0(GetPowerManagerClient, PowerManagerClient*(void)); | |
83 MOCK_METHOD0(GetPowerPolicyController, PowerPolicyController*(void)); | |
84 MOCK_METHOD0(GetSessionManagerClient, SessionManagerClient*(void)); | |
85 MOCK_METHOD0(GetSMSClient, SMSClient*(void)); | |
86 MOCK_METHOD0(GetSystemClockClient, SystemClockClient*(void)); | |
87 MOCK_METHOD0(GetUpdateEngineClient, UpdateEngineClient*(void)); | |
88 MOCK_METHOD0(GetIBusClient, IBusClient*(void)); | |
89 | |
90 FakeBluetoothAdapterClient* fake_bluetooth_adapter_client() { | |
91 return fake_bluetooth_adapter_client_.get(); | |
92 } | |
93 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client() { | |
94 return fake_bluetooth_agent_manager_client_.get(); | |
95 } | |
96 FakeBluetoothDeviceClient* fake_bluetooth_device_client() { | |
97 return fake_bluetooth_device_client_.get(); | |
98 } | |
99 FakeBluetoothInputClient* fake_bluetooth_input_client() { | |
100 return fake_bluetooth_input_client_.get(); | |
101 } | |
102 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client() { | |
103 return fake_bluetooth_profile_manager_client_.get(); | |
104 } | |
105 FakeGsmSMSClient* fake_gsm_sms_client() { | |
106 return fake_gsm_sms_client_.get(); | |
107 } | |
108 FakeNfcAdapterClient* fake_nfc_adapter_client() { | |
109 return fake_nfc_adapter_client_.get(); | |
110 } | |
111 FakeNfcDeviceClient* fake_nfc_device_client() { | |
112 return fake_nfc_device_client_.get(); | |
113 } | |
114 FakeNfcManagerClient* fake_nfc_manager_client() { | |
115 return fake_nfc_manager_client_.get(); | |
116 } | |
117 FakeNfcTagClient* fake_nfc_tag_client() { | |
118 return fake_nfc_tag_client_.get(); | |
119 } | |
120 FakeShillDeviceClient* fake_shill_device_client() { | |
121 return fake_shill_device_client_.get(); | |
122 } | |
123 FakeShillIPConfigClient* fake_shill_ipconfig_client() { | |
124 return fake_shill_ipconfig_client_.get(); | |
125 } | |
126 MockCryptohomeClient* mock_cryptohome_client() { | |
127 return mock_cryptohome_client_.get(); | |
128 } | |
129 MockShillManagerClient* mock_shill_manager_client() { | |
130 return mock_shill_manager_client_.get(); | |
131 } | |
132 MockShillProfileClient* mock_shill_profile_client() { | |
133 return mock_shill_profile_client_.get(); | |
134 } | |
135 MockShillServiceClient* mock_shill_service_client() { | |
136 return mock_shill_service_client_.get(); | |
137 } | |
138 MockSessionManagerClient* mock_session_manager_client() { | |
139 return mock_session_manager_client_.get(); | |
140 } | |
141 | |
142 private: | |
143 // Note: Keep this before other members so they can call AddObserver() in | |
144 // their c'tors. | |
145 ObserverList<DBusThreadManagerObserver> observers_; | |
146 | |
147 scoped_ptr<FakeBluetoothAdapterClient> fake_bluetooth_adapter_client_; | |
148 scoped_ptr<FakeBluetoothAgentManagerClient> | |
149 fake_bluetooth_agent_manager_client_; | |
150 scoped_ptr<FakeBluetoothDeviceClient> fake_bluetooth_device_client_; | |
151 scoped_ptr<FakeBluetoothInputClient> fake_bluetooth_input_client_; | |
152 scoped_ptr<FakeBluetoothProfileManagerClient> | |
153 fake_bluetooth_profile_manager_client_; | |
154 scoped_ptr<FakeGsmSMSClient> fake_gsm_sms_client_; | |
155 scoped_ptr<FakeNfcAdapterClient> fake_nfc_adapter_client_; | |
156 scoped_ptr<FakeNfcDeviceClient> fake_nfc_device_client_; | |
157 scoped_ptr<FakeNfcManagerClient> fake_nfc_manager_client_; | |
158 scoped_ptr<FakeNfcTagClient> fake_nfc_tag_client_; | |
159 scoped_ptr<FakeShillDeviceClient> fake_shill_device_client_; | |
160 scoped_ptr<FakeShillIPConfigClient> fake_shill_ipconfig_client_; | |
161 scoped_ptr<MockCryptohomeClient> mock_cryptohome_client_; | |
162 scoped_ptr<MockShillManagerClient> mock_shill_manager_client_; | |
163 scoped_ptr<MockShillProfileClient> mock_shill_profile_client_; | |
164 scoped_ptr<MockShillServiceClient> mock_shill_service_client_; | |
165 scoped_ptr<MockSessionManagerClient> mock_session_manager_client_; | |
166 | |
167 DISALLOW_COPY_AND_ASSIGN(MockDBusThreadManager); | |
168 }; | |
169 | |
170 } // namespace chromeos | |
171 | |
172 #endif // CHROMEOS_DBUS_MOCK_DBUS_THREAD_MANAGER_H_ | |
OLD | NEW |