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 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h"
7 #include "chromeos/dbus/dbus_thread_manager_observer.h"
8 #include "chromeos/dbus/fake_bluetooth_adapter_client.h"
9 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
10 #include "chromeos/dbus/fake_bluetooth_device_client.h"
11 #include "chromeos/dbus/fake_bluetooth_input_client.h"
12 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
13 #include "chromeos/dbus/fake_cros_disks_client.h"
14 #include "chromeos/dbus/fake_cryptohome_client.h"
15 #include "chromeos/dbus/fake_gsm_sms_client.h"
16 #include "chromeos/dbus/fake_image_burner_client.h"
17 #include "chromeos/dbus/fake_power_manager_client.h"
18 #include "chromeos/dbus/fake_session_manager_client.h"
19 #include "chromeos/dbus/fake_shill_manager_client.h"
20 #include "chromeos/dbus/fake_system_clock_client.h"
21 #include "chromeos/dbus/fake_update_engine_client.h"
22 #include "chromeos/dbus/ibus/mock_ibus_client.h"
23 #include "chromeos/dbus/ibus/mock_ibus_config_client.h"
24 #include "chromeos/dbus/ibus/mock_ibus_engine_factory_service.h"
25 #include "chromeos/dbus/ibus/mock_ibus_engine_service.h"
26 #include "chromeos/dbus/ibus/mock_ibus_input_context_client.h"
27 #include "chromeos/dbus/ibus/mock_ibus_panel_service.h"
28 #include "chromeos/dbus/power_policy_controller.h"
32 MockDBusThreadManagerWithoutGMock::MockDBusThreadManagerWithoutGMock()
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_session_manager_client_(new FakeSessionManagerClient
),
44 fake_shill_manager_client_(new FakeShillManagerClient
),
45 fake_system_clock_client_(new FakeSystemClockClient
),
46 fake_power_manager_client_(new FakePowerManagerClient
),
47 fake_update_engine_client_(new FakeUpdateEngineClient
),
49 power_policy_controller_
.reset(
50 new PowerPolicyController(this, fake_power_manager_client_
.get()));
53 MockDBusThreadManagerWithoutGMock::~MockDBusThreadManagerWithoutGMock() {
54 FOR_EACH_OBSERVER(DBusThreadManagerObserver
, observers_
,
55 OnDBusThreadManagerDestroying(this));
58 void MockDBusThreadManagerWithoutGMock::AddObserver(
59 DBusThreadManagerObserver
* observer
) {
61 observers_
.AddObserver(observer
);
64 void MockDBusThreadManagerWithoutGMock::RemoveObserver(
65 DBusThreadManagerObserver
* observer
) {
67 observers_
.RemoveObserver(observer
);
70 void MockDBusThreadManagerWithoutGMock::InitIBusBus(
71 const std::string
& ibus_address
,
72 const base::Closure
& closure
) {
73 // Non-null bus address is used to ensure the connection to ibus-daemon.
74 ibus_bus_
= reinterpret_cast<dbus::Bus
*>(0xdeadbeef);
75 mock_ibus_client_
.reset(new MockIBusClient
);
76 mock_ibus_config_client_
.reset(new MockIBusConfigClient
);
77 mock_ibus_input_context_client_
.reset(new MockIBusInputContextClient
);
78 mock_ibus_engine_service_
.reset(new MockIBusEngineService
);
79 mock_ibus_engine_factory_service_
.reset(new MockIBusEngineFactoryService
);
80 mock_ibus_panel_service_
.reset(new MockIBusPanelService
);
83 dbus::Bus
* MockDBusThreadManagerWithoutGMock::GetSystemBus() {
87 dbus::Bus
* MockDBusThreadManagerWithoutGMock::GetIBusBus() {
91 CrasAudioClient
* MockDBusThreadManagerWithoutGMock::GetCrasAudioClient() {
95 CrosDisksClient
* MockDBusThreadManagerWithoutGMock::GetCrosDisksClient() {
96 return fake_cros_disks_client_
.get();
99 CryptohomeClient
* MockDBusThreadManagerWithoutGMock::GetCryptohomeClient() {
100 return fake_cryptohome_client_
.get();
103 DebugDaemonClient
* MockDBusThreadManagerWithoutGMock::GetDebugDaemonClient() {
108 ExperimentalBluetoothAdapterClient
*
109 MockDBusThreadManagerWithoutGMock::GetExperimentalBluetoothAdapterClient() {
110 return fake_bluetooth_adapter_client_
.get();
113 ExperimentalBluetoothAgentManagerClient
*
114 MockDBusThreadManagerWithoutGMock::
115 GetExperimentalBluetoothAgentManagerClient() {
116 return fake_bluetooth_agent_manager_client_
.get();
119 ExperimentalBluetoothDeviceClient
*
120 MockDBusThreadManagerWithoutGMock::GetExperimentalBluetoothDeviceClient() {
121 return fake_bluetooth_device_client_
.get();
124 ExperimentalBluetoothInputClient
*
125 MockDBusThreadManagerWithoutGMock::GetExperimentalBluetoothInputClient() {
126 return fake_bluetooth_input_client_
.get();
129 ExperimentalBluetoothProfileManagerClient
*
130 MockDBusThreadManagerWithoutGMock::
131 GetExperimentalBluetoothProfileManagerClient() {
132 return fake_bluetooth_profile_manager_client_
.get();
136 MockDBusThreadManagerWithoutGMock::GetShillDeviceClient() {
142 MockDBusThreadManagerWithoutGMock::GetShillIPConfigClient() {
148 MockDBusThreadManagerWithoutGMock::GetShillManagerClient() {
149 return fake_shill_manager_client_
.get();
153 MockDBusThreadManagerWithoutGMock::GetShillProfileClient() {
159 MockDBusThreadManagerWithoutGMock::GetShillServiceClient() {
164 GsmSMSClient
* MockDBusThreadManagerWithoutGMock::GetGsmSMSClient() {
165 return fake_gsm_sms_client_
.get();
168 ImageBurnerClient
* MockDBusThreadManagerWithoutGMock::GetImageBurnerClient() {
169 return fake_image_burner_client_
.get();
172 IntrospectableClient
*
173 MockDBusThreadManagerWithoutGMock::GetIntrospectableClient() {
178 ModemMessagingClient
*
179 MockDBusThreadManagerWithoutGMock::GetModemMessagingClient() {
184 PermissionBrokerClient
*
185 MockDBusThreadManagerWithoutGMock::GetPermissionBrokerClient() {
190 PowerManagerClient
* MockDBusThreadManagerWithoutGMock::GetPowerManagerClient() {
191 return fake_power_manager_client_
.get();
194 PowerPolicyController
*
195 MockDBusThreadManagerWithoutGMock::GetPowerPolicyController() {
196 return power_policy_controller_
.get();
199 SessionManagerClient
*
200 MockDBusThreadManagerWithoutGMock::GetSessionManagerClient() {
201 return fake_session_manager_client_
.get();
204 SMSClient
* MockDBusThreadManagerWithoutGMock::GetSMSClient() {
209 SystemClockClient
* MockDBusThreadManagerWithoutGMock::GetSystemClockClient() {
210 return fake_system_clock_client_
.get();
213 UpdateEngineClient
* MockDBusThreadManagerWithoutGMock::GetUpdateEngineClient() {
214 return fake_update_engine_client_
.get();
217 IBusClient
* MockDBusThreadManagerWithoutGMock::GetIBusClient() {
218 return mock_ibus_client_
.get();
221 IBusConfigClient
* MockDBusThreadManagerWithoutGMock::GetIBusConfigClient() {
222 return mock_ibus_config_client_
.get();
225 IBusInputContextClient
*
226 MockDBusThreadManagerWithoutGMock::GetIBusInputContextClient() {
227 return mock_ibus_input_context_client_
.get();
230 IBusEngineFactoryService
*
231 MockDBusThreadManagerWithoutGMock::GetIBusEngineFactoryService() {
232 return mock_ibus_engine_factory_service_
.get();
235 IBusEngineService
* MockDBusThreadManagerWithoutGMock::GetIBusEngineService(
236 const dbus::ObjectPath
& object_path
) {
237 return mock_ibus_engine_service_
.get();
240 void MockDBusThreadManagerWithoutGMock::RemoveIBusEngineService(
241 const dbus::ObjectPath
& object_path
) {
244 IBusPanelService
* MockDBusThreadManagerWithoutGMock::GetIBusPanelService() {
245 return mock_ibus_panel_service_
.get();
248 } // namespace chromeos