Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: chromeos/dbus/fake_dbus_thread_manager.cc

Issue 49773003: ChromeOS: Remove MockDBusThreadManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/dbus/fake_dbus_thread_manager.h" 5 #include "chromeos/dbus/fake_dbus_thread_manager.h"
6 6
7 #include "chromeos/dbus/bluetooth_adapter_client.h"
8 #include "chromeos/dbus/bluetooth_agent_manager_client.h"
9 #include "chromeos/dbus/bluetooth_device_client.h"
10 #include "chromeos/dbus/bluetooth_input_client.h"
11 #include "chromeos/dbus/bluetooth_profile_manager_client.h"
12 #include "chromeos/dbus/cras_audio_client.h"
13 #include "chromeos/dbus/cros_disks_client.h"
14 #include "chromeos/dbus/cryptohome_client.h"
15 #include "chromeos/dbus/dbus_client.h"
16 #include "chromeos/dbus/dbus_thread_manager.h"
7 #include "chromeos/dbus/dbus_thread_manager_observer.h" 17 #include "chromeos/dbus/dbus_thread_manager_observer.h"
8 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" 18 #include "chromeos/dbus/debug_daemon_client.h"
9 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" 19 #include "chromeos/dbus/gsm_sms_client.h"
10 #include "chromeos/dbus/fake_bluetooth_device_client.h" 20 #include "chromeos/dbus/ibus/ibus_client.h"
11 #include "chromeos/dbus/fake_bluetooth_input_client.h" 21 #include "chromeos/dbus/image_burner_client.h"
12 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" 22 #include "chromeos/dbus/introspectable_client.h"
13 #include "chromeos/dbus/fake_cros_disks_client.h" 23 #include "chromeos/dbus/modem_messaging_client.h"
14 #include "chromeos/dbus/fake_cryptohome_client.h" 24 #include "chromeos/dbus/nfc_adapter_client.h"
15 #include "chromeos/dbus/fake_gsm_sms_client.h" 25 #include "chromeos/dbus/nfc_device_client.h"
16 #include "chromeos/dbus/fake_image_burner_client.h" 26 #include "chromeos/dbus/nfc_manager_client.h"
17 #include "chromeos/dbus/fake_nfc_adapter_client.h" 27 #include "chromeos/dbus/nfc_tag_client.h"
18 #include "chromeos/dbus/fake_nfc_device_client.h" 28 #include "chromeos/dbus/permission_broker_client.h"
19 #include "chromeos/dbus/fake_nfc_manager_client.h" 29 #include "chromeos/dbus/power_manager_client.h"
20 #include "chromeos/dbus/fake_nfc_tag_client.h"
21 #include "chromeos/dbus/fake_power_manager_client.h"
22 #include "chromeos/dbus/fake_session_manager_client.h"
23 #include "chromeos/dbus/fake_shill_device_client.h"
24 #include "chromeos/dbus/fake_shill_manager_client.h"
25 #include "chromeos/dbus/fake_system_clock_client.h"
26 #include "chromeos/dbus/fake_update_engine_client.h"
27 #include "chromeos/dbus/ibus/mock_ibus_client.h"
28 #include "chromeos/dbus/power_policy_controller.h" 30 #include "chromeos/dbus/power_policy_controller.h"
31 #include "chromeos/dbus/session_manager_client.h"
32 #include "chromeos/dbus/shill_device_client.h"
33 #include "chromeos/dbus/shill_ipconfig_client.h"
34 #include "chromeos/dbus/shill_manager_client.h"
35 #include "chromeos/dbus/shill_profile_client.h"
36 #include "chromeos/dbus/shill_service_client.h"
37 #include "chromeos/dbus/sms_client.h"
38 #include "chromeos/dbus/system_clock_client.h"
39 #include "chromeos/dbus/update_engine_client.h"
29 40
30 namespace chromeos { 41 namespace chromeos {
31 42
32 FakeDBusThreadManager::FakeDBusThreadManager() 43 FakeDBusThreadManager::FakeDBusThreadManager() {
33 : fake_bluetooth_adapter_client_(new FakeBluetoothAdapterClient()),
34 fake_bluetooth_agent_manager_client_(new FakeBluetoothAgentManagerClient()),
35 fake_bluetooth_device_client_(new FakeBluetoothDeviceClient()),
36 fake_bluetooth_input_client_(new FakeBluetoothInputClient()),
37 fake_bluetooth_profile_manager_client_(
38 new FakeBluetoothProfileManagerClient()),
39 fake_cros_disks_client_(new FakeCrosDisksClient),
40 fake_cryptohome_client_(new FakeCryptohomeClient),
41 fake_gsm_sms_client_(new FakeGsmSMSClient),
42 fake_image_burner_client_(new FakeImageBurnerClient),
43 fake_nfc_adapter_client_(new FakeNfcAdapterClient()),
44 fake_nfc_device_client_(new FakeNfcDeviceClient()),
45 fake_nfc_manager_client_(new FakeNfcManagerClient()),
46 fake_nfc_tag_client_(new FakeNfcTagClient()),
47 fake_session_manager_client_(new FakeSessionManagerClient),
48 fake_shill_device_client_(new FakeShillDeviceClient),
49 fake_shill_manager_client_(new FakeShillManagerClient),
50 fake_system_clock_client_(new FakeSystemClockClient),
51 fake_power_manager_client_(new FakePowerManagerClient),
52 fake_update_engine_client_(new FakeUpdateEngineClient),
53 ibus_bus_(NULL) {
54 power_policy_controller_.reset(
55 new PowerPolicyController(this, fake_power_manager_client_.get()));
56 } 44 }
57 45
58 FakeDBusThreadManager::~FakeDBusThreadManager() { 46 FakeDBusThreadManager::~FakeDBusThreadManager() {
59 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_, 47 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_,
60 OnDBusThreadManagerDestroying(this)); 48 OnDBusThreadManagerDestroying(this));
61 } 49 }
62 50
51 void FakeDBusThreadManager::SetBluetoothAdapterClient(
52 scoped_ptr<BluetoothAdapterClient> client) {
53 bluetooth_adapter_client_ = client.Pass();
54 }
55
56 void FakeDBusThreadManager::SetBluetoothAgentManagerClient(
57 scoped_ptr<BluetoothAgentManagerClient> client) {
58 bluetooth_agent_manager_client_ = client.Pass();
59 }
60
61 void FakeDBusThreadManager::SetBluetoothDeviceClient(
62 scoped_ptr<BluetoothDeviceClient> client) {
63 bluetooth_device_client_ = client.Pass();
64 }
65
66 void FakeDBusThreadManager::SetBluetoothInputClient(
67 scoped_ptr<BluetoothInputClient> client) {
68 bluetooth_input_client_ = client.Pass();
69 }
70
71 void FakeDBusThreadManager::SetBluetoothProfileManagerClient(
72 scoped_ptr<BluetoothProfileManagerClient> client) {
73 bluetooth_profile_manager_client_ = client.Pass();
74 }
75
76 void FakeDBusThreadManager::SetCrasAudioClient(
77 scoped_ptr<CrasAudioClient> client) {
78 cras_audio_client_ = client.Pass();
79 }
80
81 void FakeDBusThreadManager::SetCrosDisksClient(
82 scoped_ptr<CrosDisksClient> client) {
83 cros_disks_client_ = client.Pass();
84 }
85
86 void FakeDBusThreadManager::SetCryptohomeClient(
87 scoped_ptr<CryptohomeClient> client) {
88 cryptohome_client_ = client.Pass();
89 }
90
91 void FakeDBusThreadManager::SetDebugDaemonClient(
92 scoped_ptr<DebugDaemonClient> client) {
93 debug_daemon_client_ = client.Pass();
94 }
95
96 void FakeDBusThreadManager::SetShillDeviceClient(
97 scoped_ptr<ShillDeviceClient> client) {
98 shill_device_client_ = client.Pass();
99 }
100
101 void FakeDBusThreadManager::SetShillIPConfigClient(
102 scoped_ptr<ShillIPConfigClient> client) {
103 shill_ipconfig_client_ = client.Pass();
104 }
105
106 void FakeDBusThreadManager::SetShillManagerClient(
107 scoped_ptr<ShillManagerClient> client) {
108 shill_manager_client_ = client.Pass();
109 }
110
111 void FakeDBusThreadManager::SetShillServiceClient(
112 scoped_ptr<ShillServiceClient> client) {
113 shill_service_client_ = client.Pass();
114 }
115
116 void FakeDBusThreadManager::SetShillProfileClient(
117 scoped_ptr<ShillProfileClient> client) {
118 shill_profile_client_ = client.Pass();
119 }
120
121 void FakeDBusThreadManager::SetGsmSMSClient(
122 scoped_ptr<GsmSMSClient> client) {
123 gsm_sms_client_ = client.Pass();
124 }
125
126 void FakeDBusThreadManager::SetImageBurnerClient(
127 scoped_ptr<ImageBurnerClient> client) {
128 image_burner_client_ = client.Pass();
129 }
130
131 void FakeDBusThreadManager::SetIntrospectableClient(
132 scoped_ptr<IntrospectableClient> client) {
133 introspectable_client_ = client.Pass();
134 }
135
136 void FakeDBusThreadManager::SetModemMessagingClient(
137 scoped_ptr<ModemMessagingClient> client) {
138 modem_messaging_client_ = client.Pass();
139 }
140
141 void FakeDBusThreadManager::SetNfcAdapterClient(
142 scoped_ptr<NfcAdapterClient> client) {
143 nfc_adapter_client_ = client.Pass();
144 }
145
146 void FakeDBusThreadManager::SetNfcDeviceClient(
147 scoped_ptr<NfcDeviceClient> client) {
148 nfc_device_client_ = client.Pass();
149 }
150
151 void FakeDBusThreadManager::SetNfcManagerClient(
152 scoped_ptr<NfcManagerClient> client) {
153 nfc_manager_client_ = client.Pass();
154 }
155
156 void FakeDBusThreadManager::SetNfcTagClient(
157 scoped_ptr<NfcTagClient> client) {
158 nfc_tag_client_ = client.Pass();
159 }
160
161 void FakeDBusThreadManager::SetPermissionBrokerClient(
162 scoped_ptr<PermissionBrokerClient> client) {
163 permission_broker_client_ = client.Pass();
164 }
165
166 void FakeDBusThreadManager::SetPowerManagerClient(
167 scoped_ptr<PowerManagerClient> client) {
168 power_manager_client_ = client.Pass();
169 }
170
171 void FakeDBusThreadManager::SetPowerPolicyController(
172 scoped_ptr<PowerPolicyController> client) {
173 power_policy_controller_ = client.Pass();
174 }
175
176 void FakeDBusThreadManager::SetSessionManagerClient(
177 scoped_ptr<SessionManagerClient> client) {
178 session_manager_client_ = client.Pass();
179 }
180
181 void FakeDBusThreadManager::SetSMSClient(scoped_ptr<SMSClient> client) {
182 sms_client_ = client.Pass();
183 }
184
185 void FakeDBusThreadManager::SetSystemClockClient(
186 scoped_ptr<SystemClockClient> client) {
187 system_clock_client_ = client.Pass();
188 }
189
190 void FakeDBusThreadManager::SetUpdateEngineClient(
191 scoped_ptr<UpdateEngineClient> client) {
192 update_engine_client_ = client.Pass();
193 }
194
195 void FakeDBusThreadManager::SetIBusClient(scoped_ptr<IBusClient> client) {
196 ibus_client_ = client.Pass();
197 }
198
63 void FakeDBusThreadManager::AddObserver( 199 void FakeDBusThreadManager::AddObserver(
64 DBusThreadManagerObserver* observer) { 200 DBusThreadManagerObserver* observer) {
65 DCHECK(observer); 201 DCHECK(observer);
66 observers_.AddObserver(observer); 202 observers_.AddObserver(observer);
67 } 203 }
68 204
69 void FakeDBusThreadManager::RemoveObserver( 205 void FakeDBusThreadManager::RemoveObserver(
70 DBusThreadManagerObserver* observer) { 206 DBusThreadManagerObserver* observer) {
71 DCHECK(observer); 207 DCHECK(observer);
72 observers_.RemoveObserver(observer); 208 observers_.RemoveObserver(observer);
73 } 209 }
74 210
75 void FakeDBusThreadManager::InitIBusBus( 211 void FakeDBusThreadManager::InitIBusBus(
76 const std::string& ibus_address, 212 const std::string& ibus_address,
77 const base::Closure& closure) { 213 const base::Closure& closure) {
78 // Non-null bus address is used to ensure the connection to ibus-daemon.
79 ibus_bus_ = reinterpret_cast<dbus::Bus*>(0xdeadbeef);
80 mock_ibus_client_.reset(new MockIBusClient);
81 } 214 }
82 215
83 dbus::Bus* FakeDBusThreadManager::GetSystemBus() { 216 dbus::Bus* FakeDBusThreadManager::GetSystemBus() {
84 return NULL; 217 return NULL;
85 } 218 }
86 219
87 BluetoothAdapterClient* 220 BluetoothAdapterClient*
88 FakeDBusThreadManager::GetBluetoothAdapterClient() { 221 FakeDBusThreadManager::GetBluetoothAdapterClient() {
89 return fake_bluetooth_adapter_client_.get(); 222 return bluetooth_adapter_client_.get();
90 } 223 }
91 224
92 BluetoothAgentManagerClient* 225 BluetoothAgentManagerClient*
93 FakeDBusThreadManager::GetBluetoothAgentManagerClient() { 226 FakeDBusThreadManager::GetBluetoothAgentManagerClient() {
94 return fake_bluetooth_agent_manager_client_.get(); 227 return bluetooth_agent_manager_client_.get();
95 } 228 }
96 229
97 BluetoothDeviceClient* 230 BluetoothDeviceClient*
98 FakeDBusThreadManager::GetBluetoothDeviceClient() { 231 FakeDBusThreadManager::GetBluetoothDeviceClient() {
99 return fake_bluetooth_device_client_.get(); 232 return bluetooth_device_client_.get();
100 } 233 }
101 234
102 BluetoothInputClient* 235 BluetoothInputClient*
103 FakeDBusThreadManager::GetBluetoothInputClient() { 236 FakeDBusThreadManager::GetBluetoothInputClient() {
104 return fake_bluetooth_input_client_.get(); 237 return bluetooth_input_client_.get();
105 } 238 }
106 239
107 BluetoothProfileManagerClient* 240 BluetoothProfileManagerClient*
108 FakeDBusThreadManager::GetBluetoothProfileManagerClient() { 241 FakeDBusThreadManager::GetBluetoothProfileManagerClient() {
109 return fake_bluetooth_profile_manager_client_.get(); 242 return bluetooth_profile_manager_client_.get();
110 } 243 }
111 244
112 CrasAudioClient* FakeDBusThreadManager::GetCrasAudioClient() { 245 CrasAudioClient* FakeDBusThreadManager::GetCrasAudioClient() {
113 return NULL; 246 return cras_audio_client_.get();
114 } 247 }
115 248
116 CrosDisksClient* FakeDBusThreadManager::GetCrosDisksClient() { 249 CrosDisksClient* FakeDBusThreadManager::GetCrosDisksClient() {
117 return fake_cros_disks_client_.get(); 250 return cros_disks_client_.get();
118 } 251 }
119 252
120 CryptohomeClient* FakeDBusThreadManager::GetCryptohomeClient() { 253 CryptohomeClient* FakeDBusThreadManager::GetCryptohomeClient() {
121 return fake_cryptohome_client_.get(); 254 return cryptohome_client_.get();
122 } 255 }
123 256
124 DebugDaemonClient* FakeDBusThreadManager::GetDebugDaemonClient() { 257 DebugDaemonClient* FakeDBusThreadManager::GetDebugDaemonClient() {
125 NOTIMPLEMENTED(); 258 return debug_daemon_client_.get();
126 return NULL;
127 } 259 }
128 260
129 ShillDeviceClient* 261 ShillDeviceClient*
130 FakeDBusThreadManager::GetShillDeviceClient() { 262 FakeDBusThreadManager::GetShillDeviceClient() {
131 return fake_shill_device_client_.get(); 263 return shill_device_client_.get();
132 } 264 }
133 265
134 ShillIPConfigClient* 266 ShillIPConfigClient*
135 FakeDBusThreadManager::GetShillIPConfigClient() { 267 FakeDBusThreadManager::GetShillIPConfigClient() {
136 NOTIMPLEMENTED(); 268 return shill_ipconfig_client_.get();
137 return NULL;
138 } 269 }
139 270
140 ShillManagerClient* 271 ShillManagerClient*
141 FakeDBusThreadManager::GetShillManagerClient() { 272 FakeDBusThreadManager::GetShillManagerClient() {
142 return fake_shill_manager_client_.get(); 273 return shill_manager_client_.get();
143 } 274 }
144 275
145 ShillProfileClient* 276 ShillProfileClient*
146 FakeDBusThreadManager::GetShillProfileClient() { 277 FakeDBusThreadManager::GetShillProfileClient() {
147 NOTIMPLEMENTED(); 278 return shill_profile_client_.get();
148 return NULL;
149 } 279 }
150 280
151 ShillServiceClient* 281 ShillServiceClient*
152 FakeDBusThreadManager::GetShillServiceClient() { 282 FakeDBusThreadManager::GetShillServiceClient() {
153 NOTIMPLEMENTED(); 283 return shill_service_client_.get();
154 return NULL;
155 } 284 }
156 285
157 GsmSMSClient* FakeDBusThreadManager::GetGsmSMSClient() { 286 GsmSMSClient* FakeDBusThreadManager::GetGsmSMSClient() {
158 return fake_gsm_sms_client_.get(); 287 return gsm_sms_client_.get();
159 } 288 }
160 289
161 ImageBurnerClient* FakeDBusThreadManager::GetImageBurnerClient() { 290 ImageBurnerClient* FakeDBusThreadManager::GetImageBurnerClient() {
162 return fake_image_burner_client_.get(); 291 return image_burner_client_.get();
163 } 292 }
164 293
165 IntrospectableClient* 294 IntrospectableClient*
166 FakeDBusThreadManager::GetIntrospectableClient() { 295 FakeDBusThreadManager::GetIntrospectableClient() {
167 NOTIMPLEMENTED(); 296 return introspectable_client_.get();
168 return NULL;
169 } 297 }
170 298
171 ModemMessagingClient* 299 ModemMessagingClient*
172 FakeDBusThreadManager::GetModemMessagingClient() { 300 FakeDBusThreadManager::GetModemMessagingClient() {
173 NOTIMPLEMENTED(); 301 return modem_messaging_client_.get();
174 return NULL;
175 } 302 }
176 303
177 NfcAdapterClient* FakeDBusThreadManager::GetNfcAdapterClient() { 304 NfcAdapterClient* FakeDBusThreadManager::GetNfcAdapterClient() {
178 return fake_nfc_adapter_client_.get(); 305 return nfc_adapter_client_.get();
179 } 306 }
180 307
181 NfcDeviceClient* FakeDBusThreadManager::GetNfcDeviceClient() { 308 NfcDeviceClient* FakeDBusThreadManager::GetNfcDeviceClient() {
182 return fake_nfc_device_client_.get(); 309 return nfc_device_client_.get();
183 } 310 }
184 311
185 NfcManagerClient* FakeDBusThreadManager::GetNfcManagerClient() { 312 NfcManagerClient* FakeDBusThreadManager::GetNfcManagerClient() {
186 return fake_nfc_manager_client_.get(); 313 return nfc_manager_client_.get();
187 } 314 }
188 315
189 NfcTagClient* FakeDBusThreadManager::GetNfcTagClient() { 316 NfcTagClient* FakeDBusThreadManager::GetNfcTagClient() {
190 return fake_nfc_tag_client_.get(); 317 return nfc_tag_client_.get();
191 } 318 }
192 319
193 PermissionBrokerClient* 320 PermissionBrokerClient*
194 FakeDBusThreadManager::GetPermissionBrokerClient() { 321 FakeDBusThreadManager::GetPermissionBrokerClient() {
195 NOTIMPLEMENTED(); 322 return permission_broker_client_.get();
196 return NULL;
197 } 323 }
198 324
199 PowerManagerClient* FakeDBusThreadManager::GetPowerManagerClient() { 325 PowerManagerClient* FakeDBusThreadManager::GetPowerManagerClient() {
200 return fake_power_manager_client_.get(); 326 return power_manager_client_.get();
201 } 327 }
202 328
203 PowerPolicyController* 329 PowerPolicyController*
204 FakeDBusThreadManager::GetPowerPolicyController() { 330 FakeDBusThreadManager::GetPowerPolicyController() {
205 return power_policy_controller_.get(); 331 return power_policy_controller_.get();
206 } 332 }
207 333
208 SessionManagerClient* 334 SessionManagerClient*
209 FakeDBusThreadManager::GetSessionManagerClient() { 335 FakeDBusThreadManager::GetSessionManagerClient() {
210 return fake_session_manager_client_.get(); 336 return session_manager_client_.get();
211 } 337 }
212 338
213 SMSClient* FakeDBusThreadManager::GetSMSClient() { 339 SMSClient* FakeDBusThreadManager::GetSMSClient() {
214 NOTIMPLEMENTED(); 340 return sms_client_.get();
215 return NULL;
216 } 341 }
217 342
218 SystemClockClient* FakeDBusThreadManager::GetSystemClockClient() { 343 SystemClockClient* FakeDBusThreadManager::GetSystemClockClient() {
219 return fake_system_clock_client_.get(); 344 return system_clock_client_.get();
220 } 345 }
221 346
222 UpdateEngineClient* FakeDBusThreadManager::GetUpdateEngineClient() { 347 UpdateEngineClient* FakeDBusThreadManager::GetUpdateEngineClient() {
223 return fake_update_engine_client_.get(); 348 return update_engine_client_.get();
224 } 349 }
225 350
226 IBusClient* FakeDBusThreadManager::GetIBusClient() { 351 IBusClient* FakeDBusThreadManager::GetIBusClient() {
227 return mock_ibus_client_.get(); 352 return ibus_client_.get();
228 } 353 }
229 354
230 } // namespace chromeos 355 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698