[go: nahoru, domu]

blob: 05c590d1f1cc267e64e7414ca4637645a51e5092 [file] [log] [blame]
hashimoto@chromium.orgfa9918b62012-01-16 06:36:261// Copyright (c) 2012 The Chromium Authors. All rights reserved.
satorux@chromium.orgd96e7e92011-10-29 02:30:432// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
hashimoto@chromium.org64e19922012-04-06 01:54:365#ifndef CHROMEOS_DBUS_MOCK_DBUS_THREAD_MANAGER_H_
6#define CHROMEOS_DBUS_MOCK_DBUS_THREAD_MANAGER_H_
satorux@chromium.orgd96e7e92011-10-29 02:30:437
8#include <string>
9
derat@chromium.org52c086e2012-10-08 20:50:0710#include "base/observer_list.h"
hashimoto@chromium.org64e19922012-04-06 01:54:3611#include "chromeos/dbus/dbus_thread_manager.h"
satorux@chromium.orgd96e7e92011-10-29 02:30:4312#include "testing/gmock/include/gmock/gmock.h"
13
keybuk@chromium.org24414ff2012-03-13 22:41:1114namespace dbus {
15
16class Bus;
17
18} // namespace dbus
19
satorux@chromium.orgd96e7e92011-10-29 02:30:4320namespace chromeos {
21
derat@chromium.org52c086e2012-10-08 20:50:0722class DBusThreadManagerObserver;
keybuk@chromium.org30c80d52013-05-23 20:00:1023class FakeBluetoothAdapterClient;
24class FakeBluetoothAgentManagerClient;
25class FakeBluetoothDeviceClient;
26class FakeBluetoothInputClient;
27class FakeBluetoothProfileManagerClient;
gdk@chromium.org3392da32012-09-07 04:26:5328class MockCryptohomeClient;
gspencer@chromium.org07c674cd2012-09-07 20:53:5629class MockShillDeviceClient;
30class MockShillIPConfigClient;
31class MockShillManagerClient;
gspencer@chromium.org07c674cd2012-09-07 20:53:5632class MockShillProfileClient;
33class MockShillServiceClient;
gdk@chromium.org3392da32012-09-07 04:26:5334class MockGsmSMSClient;
gdk@chromium.org3392da32012-09-07 04:26:5335class MockPowerManagerClient;
36class MockSessionManagerClient;
satorux@chromium.orgd96e7e92011-10-29 02:30:4337
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.
haruki@chromium.orgcc92d432013-04-23 05:11:1241// Please avoid adding more GMock in this class. We have an ongoing effort to
42// remove GMock dependency. TODO(haruki): crbug.com/223061.
satorux@chromium.orgd96e7e92011-10-29 02:30:4343class MockDBusThreadManager : public DBusThreadManager {
44 public:
45 MockDBusThreadManager();
46 virtual ~MockDBusThreadManager();
47
derat@chromium.org52c086e2012-10-08 20:50:0748 void AddObserver(DBusThreadManagerObserver* observer) OVERRIDE;
49 void RemoveObserver(DBusThreadManagerObserver* observer) OVERRIDE;
nona@chromium.orgfba4c312013-02-20 15:09:3050 MOCK_METHOD2(InitIBusBus, void(const std::string& ibus_address,
51 const base::Closure& closure));
keybuk@chromium.org24414ff2012-03-13 22:41:1152 MOCK_METHOD0(GetSystemBus, dbus::Bus*(void));
nona@chromium.orga97324562012-05-18 16:37:0553 MOCK_METHOD0(GetIBusBus, dbus::Bus*(void));
keybuk@chromium.org627f4f42013-06-12 14:47:3254 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));
jennyz@chromium.org1ae56b7f2013-03-28 07:28:1461 MOCK_METHOD0(GetCrasAudioClient, CrasAudioClient*(void));
hashimoto@chromium.org4ae73292011-11-15 05:20:1862 MOCK_METHOD0(GetCrosDisksClient, CrosDisksClient*(void));
hashimoto@chromium.orgb6d19b12012-02-14 02:57:2863 MOCK_METHOD0(GetCryptohomeClient, CryptohomeClient*(void));
sleffler@chromium.orgee0d7ddd2012-04-05 20:04:3064 MOCK_METHOD0(GetDebugDaemonClient, DebugDaemonClient*(void));
gspencer@chromium.org07c674cd2012-09-07 20:53:5665 MOCK_METHOD0(GetShillDeviceClient, ShillDeviceClient*(void));
66 MOCK_METHOD0(GetShillIPConfigClient, ShillIPConfigClient*(void));
67 MOCK_METHOD0(GetShillManagerClient, ShillManagerClient*(void));
gspencer@chromium.org07c674cd2012-09-07 20:53:5668 MOCK_METHOD0(GetShillProfileClient, ShillProfileClient*(void));
69 MOCK_METHOD0(GetShillServiceClient, ShillServiceClient*(void));
hashimoto@chromium.org3e87a6c2012-04-19 08:18:4870 MOCK_METHOD0(GetGsmSMSClient, GsmSMSClient*(void));
hashimoto@chromium.orgfa9918b62012-01-16 06:36:2671 MOCK_METHOD0(GetImageBurnerClient, ImageBurnerClient*(void));
keybuk@google.com39666aac2012-03-15 21:40:4772 MOCK_METHOD0(GetIntrospectableClient, IntrospectableClient*(void));
benchan@chromium.org88d6fc22012-06-12 08:57:5273 MOCK_METHOD0(GetModemMessagingClient, ModemMessagingClient*(void));
gdk@chromium.org3392da32012-09-07 04:26:5374 MOCK_METHOD0(GetPermissionBrokerClient, PermissionBrokerClient*(void));
satorux@chromium.org089e30352011-10-29 05:25:5175 MOCK_METHOD0(GetPowerManagerClient, PowerManagerClient*(void));
derat@chromium.org3a229f42013-02-07 03:09:2676 MOCK_METHOD0(GetPowerPolicyController, PowerPolicyController*(void));
satorux@chromium.org089e30352011-10-29 05:25:5177 MOCK_METHOD0(GetSessionManagerClient, SessionManagerClient*(void));
benchan@chromium.org88d6fc22012-06-12 08:57:5278 MOCK_METHOD0(GetSMSClient, SMSClient*(void));
jennyz@chromium.orgce3b13ab2013-03-14 14:54:1979 MOCK_METHOD0(GetSystemClockClient, SystemClockClient*(void));
satorux@chromium.org85c04ce2011-11-22 19:13:1380 MOCK_METHOD0(GetUpdateEngineClient, UpdateEngineClient*(void));
nona@chromium.org14a1f252012-05-23 23:17:3981 MOCK_METHOD0(GetIBusClient, IBusClient*(void));
82 MOCK_METHOD0(GetIBusInputContextClient, IBusInputContextClient*(void));
nona@chromium.org85a966c2012-07-18 19:10:5283 MOCK_METHOD0(GetIBusEngineFactoryService, IBusEngineFactoryService*(void));
84 MOCK_METHOD1(GetIBusEngineService,
85 IBusEngineService*(const dbus::ObjectPath& object_path));
nona@chromium.org60f50ed2012-08-02 04:43:2586 MOCK_METHOD1(RemoveIBusEngineService,
87 void(const dbus::ObjectPath& object_path));
satorux@chromium.orgd96e7e92011-10-29 02:30:4388
keybuk@chromium.org30c80d52013-05-23 20:00:1089 FakeBluetoothAdapterClient* fake_bluetooth_adapter_client() {
90 return fake_bluetooth_adapter_client_.get();
91 }
92 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client() {
93 return fake_bluetooth_agent_manager_client_.get();
94 }
95 FakeBluetoothDeviceClient* fake_bluetooth_device_client() {
96 return fake_bluetooth_device_client_.get();
97 }
98 FakeBluetoothInputClient* fake_bluetooth_input_client() {
99 return fake_bluetooth_input_client_.get();
100 }
101 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client() {
102 return fake_bluetooth_profile_manager_client_.get();
103 }
hashimoto@chromium.orgb6d19b12012-02-14 02:57:28104 MockCryptohomeClient* mock_cryptohome_client() {
105 return mock_cryptohome_client_.get();
sleffler@chromium.orgee0d7ddd2012-04-05 20:04:30106 }
gspencer@chromium.org07c674cd2012-09-07 20:53:56107 MockShillDeviceClient* mock_shill_device_client() {
108 return mock_shill_device_client_.get();
hashimoto@chromium.orgfa9918b62012-01-16 06:36:26109 }
gspencer@chromium.org07c674cd2012-09-07 20:53:56110 MockShillIPConfigClient* mock_shill_ipconfig_client() {
111 return mock_shill_ipconfig_client_.get();
hashimoto@chromium.orge6072392012-03-30 01:37:23112 }
gspencer@chromium.org07c674cd2012-09-07 20:53:56113 MockShillManagerClient* mock_shill_manager_client() {
114 return mock_shill_manager_client_.get();
hashimoto@chromium.org5c40dce2012-04-11 08:01:59115 }
gspencer@chromium.org07c674cd2012-09-07 20:53:56116 MockShillProfileClient* mock_shill_profile_client() {
117 return mock_shill_profile_client_.get();
hashimoto@chromium.org480e2272012-03-30 04:16:56118 }
gspencer@chromium.org07c674cd2012-09-07 20:53:56119 MockShillServiceClient* mock_shill_service_client() {
120 return mock_shill_service_client_.get();
hashimoto@chromium.orgd4c6bf02012-04-18 06:10:38121 }
hashimoto@chromium.org3e87a6c2012-04-19 08:18:48122 MockGsmSMSClient* mock_gsm_sms_client() {
123 return mock_gsm_sms_client_.get();
124 }
satorux@chromium.orgd96e7e92011-10-29 02:30:43125 MockSessionManagerClient* mock_session_manager_client() {
126 return mock_session_manager_client_.get();
satorux@chromium.org85c04ce2011-11-22 19:13:13127 }
satorux@chromium.orgd96e7e92011-10-29 02:30:43128
129 private:
derat@chromium.org3a229f42013-02-07 03:09:26130 // Note: Keep this before other members so they can call AddObserver() in
131 // their c'tors.
132 ObserverList<DBusThreadManagerObserver> observers_;
133
keybuk@chromium.org30c80d52013-05-23 20:00:10134 scoped_ptr<FakeBluetoothAdapterClient> fake_bluetooth_adapter_client_;
135 scoped_ptr<FakeBluetoothAgentManagerClient>
136 fake_bluetooth_agent_manager_client_;
137 scoped_ptr<FakeBluetoothDeviceClient> fake_bluetooth_device_client_;
138 scoped_ptr<FakeBluetoothInputClient> fake_bluetooth_input_client_;
139 scoped_ptr<FakeBluetoothProfileManagerClient>
140 fake_bluetooth_profile_manager_client_;
hashimoto@chromium.orgb6d19b12012-02-14 02:57:28141 scoped_ptr<MockCryptohomeClient> mock_cryptohome_client_;
gspencer@chromium.org07c674cd2012-09-07 20:53:56142 scoped_ptr<MockShillDeviceClient> mock_shill_device_client_;
143 scoped_ptr<MockShillIPConfigClient> mock_shill_ipconfig_client_;
144 scoped_ptr<MockShillManagerClient> mock_shill_manager_client_;
gspencer@chromium.org07c674cd2012-09-07 20:53:56145 scoped_ptr<MockShillProfileClient> mock_shill_profile_client_;
146 scoped_ptr<MockShillServiceClient> mock_shill_service_client_;
hashimoto@chromium.org3e87a6c2012-04-19 08:18:48147 scoped_ptr<MockGsmSMSClient> mock_gsm_sms_client_;
satorux@chromium.orgd96e7e92011-10-29 02:30:43148 scoped_ptr<MockSessionManagerClient> mock_session_manager_client_;
derat@chromium.org52c086e2012-10-08 20:50:07149
satorux@chromium.orgd96e7e92011-10-29 02:30:43150 DISALLOW_COPY_AND_ASSIGN(MockDBusThreadManager);
151};
152
153} // namespace chromeos
154
hashimoto@chromium.org64e19922012-04-06 01:54:36155#endif // CHROMEOS_DBUS_MOCK_DBUS_THREAD_MANAGER_H_