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

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

Issue 49773003: ChromeOS: Remove MockDBusThreadManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed tests. 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
« no previous file with comments | « chromeos/dbus/dbus_thread_manager.cc ('k') | chromeos/dbus/fake_dbus_thread_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_ 5 #ifndef CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_
6 #define CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_ 6 #define CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "chromeos/chromeos_export.h"
12 #include "chromeos/dbus/dbus_thread_manager.h" 13 #include "chromeos/dbus/dbus_thread_manager.h"
13 14
14 namespace dbus { 15 namespace dbus {
15 class Bus; 16 class Bus;
16 class ObjectPath; 17 class ObjectPath;
17 } // namespace dbus 18 } // namespace dbus
18 19
19 namespace chromeos { 20 namespace chromeos {
20 21
21 class DBusThreadManagerObserver; 22 class DBusThreadManagerObserver;
22 class FakeBluetoothAdapterClient;
23 class FakeBluetoothAgentManagerClient;
24 class FakeBluetoothDeviceClient;
25 class FakeBluetoothInputClient;
26 class FakeBluetoothProfileManagerClient;
27 class FakeCrosDisksClient;
28 class FakeCryptohomeClient;
29 class FakeGsmSMSClient;
30 class FakeNfcAdapterClient;
31 class FakeNfcDeviceClient;
32 class FakeNfcManagerClient;
33 class FakeNfcRecordClient;
34 class FakeNfcTagClient;
35 class FakePowerManagerClient;
36 class FakeImageBurnerClient;
37 class FakeSessionManagerClient;
38 class FakeShillDeviceClient;
39 class FakeShillManagerClient;
40 class FakeSystemClockClient;
41 class FakeUpdateEngineClient;
42 class MockIBusClient;
43 23
44 // This class provides a fake implementation of DBusThreadManager, which 24 // This class provides a fake implementation of DBusThreadManager, which
45 // hosts fake D-Bus clients. 25 // hosts fake D-Bus clients.
46 class FakeDBusThreadManager : public DBusThreadManager { 26 class CHROMEOS_EXPORT FakeDBusThreadManager : public DBusThreadManager {
47 public: 27 public:
48 FakeDBusThreadManager(); 28 FakeDBusThreadManager();
49 virtual ~FakeDBusThreadManager(); 29 virtual ~FakeDBusThreadManager();
50 30
31 // Creates and sets all fake DBusClients and the PowerPolicyController.
32 void SetFakeClients();
33
34 void SetBluetoothAdapterClient(scoped_ptr<BluetoothAdapterClient> client);
35 void SetBluetoothAgentManagerClient(
36 scoped_ptr<BluetoothAgentManagerClient> client);
37 void SetBluetoothDeviceClient(scoped_ptr<BluetoothDeviceClient> client);
38 void SetBluetoothInputClient(scoped_ptr<BluetoothInputClient> client);
39 void SetBluetoothProfileManagerClient(
40 scoped_ptr<BluetoothProfileManagerClient> client);
41 void SetCrasAudioClient(scoped_ptr<CrasAudioClient> client);
42 void SetCrosDisksClient(scoped_ptr<CrosDisksClient> client);
43 void SetCryptohomeClient(scoped_ptr<CryptohomeClient> client);
44 void SetDebugDaemonClient(scoped_ptr<DebugDaemonClient> client);
45 void SetShillDeviceClient(scoped_ptr<ShillDeviceClient> client);
46 void SetShillIPConfigClient(scoped_ptr<ShillIPConfigClient> client);
47 void SetShillManagerClient(scoped_ptr<ShillManagerClient> client);
48 void SetShillServiceClient(scoped_ptr<ShillServiceClient> client);
49 void SetShillProfileClient(scoped_ptr<ShillProfileClient> client);
50 void SetGsmSMSClient(scoped_ptr<GsmSMSClient> client);
51 void SetImageBurnerClient(scoped_ptr<ImageBurnerClient> client);
52 void SetIntrospectableClient(scoped_ptr<IntrospectableClient> client);
53 void SetModemMessagingClient(scoped_ptr<ModemMessagingClient> client);
54 void SetNfcAdapterClient(scoped_ptr<NfcAdapterClient> client);
55 void SetNfcDeviceClient(scoped_ptr<NfcDeviceClient> client);
56 void SetNfcManagerClient(scoped_ptr<NfcManagerClient> client);
57 void SetNfcRecordClient(scoped_ptr<NfcRecordClient> client);
58 void SetNfcTagClient(scoped_ptr<NfcTagClient> client);
59 void SetPermissionBrokerClient(scoped_ptr<PermissionBrokerClient> client);
60 void SetPowerManagerClient(scoped_ptr<PowerManagerClient> client);
61 void SetPowerPolicyController(scoped_ptr<PowerPolicyController> client);
62 void SetSessionManagerClient(scoped_ptr<SessionManagerClient> client);
63 void SetSMSClient(scoped_ptr<SMSClient> client);
64 void SetSystemClockClient(scoped_ptr<SystemClockClient> client);
65 void SetUpdateEngineClient(scoped_ptr<UpdateEngineClient> client);
66 void SetIBusClient(scoped_ptr<IBusClient> client);
67
51 virtual void AddObserver(DBusThreadManagerObserver* observer) OVERRIDE; 68 virtual void AddObserver(DBusThreadManagerObserver* observer) OVERRIDE;
52 virtual void RemoveObserver(DBusThreadManagerObserver* observer) OVERRIDE; 69 virtual void RemoveObserver(DBusThreadManagerObserver* observer) OVERRIDE;
53 virtual void InitIBusBus(const std::string& ibus_address, 70 virtual void InitIBusBus(const std::string& ibus_address,
54 const base::Closure& closure) OVERRIDE; 71 const base::Closure& closure) OVERRIDE;
55 virtual dbus::Bus* GetSystemBus() OVERRIDE; 72 virtual dbus::Bus* GetSystemBus() OVERRIDE;
56 73
57 virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE; 74 virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE;
58 virtual BluetoothAgentManagerClient* 75 virtual BluetoothAgentManagerClient*
59 GetBluetoothAgentManagerClient() OVERRIDE; 76 GetBluetoothAgentManagerClient() OVERRIDE;
60 virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE; 77 virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE;
(...skipping 20 matching lines...) Expand all
81 virtual NfcTagClient* GetNfcTagClient() OVERRIDE; 98 virtual NfcTagClient* GetNfcTagClient() OVERRIDE;
82 virtual PermissionBrokerClient* GetPermissionBrokerClient() OVERRIDE; 99 virtual PermissionBrokerClient* GetPermissionBrokerClient() OVERRIDE;
83 virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE; 100 virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE;
84 virtual PowerPolicyController* GetPowerPolicyController() OVERRIDE; 101 virtual PowerPolicyController* GetPowerPolicyController() OVERRIDE;
85 virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE; 102 virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE;
86 virtual SMSClient* GetSMSClient() OVERRIDE; 103 virtual SMSClient* GetSMSClient() OVERRIDE;
87 virtual SystemClockClient* GetSystemClockClient() OVERRIDE; 104 virtual SystemClockClient* GetSystemClockClient() OVERRIDE;
88 virtual UpdateEngineClient* GetUpdateEngineClient() OVERRIDE; 105 virtual UpdateEngineClient* GetUpdateEngineClient() OVERRIDE;
89 virtual IBusClient* GetIBusClient() OVERRIDE; 106 virtual IBusClient* GetIBusClient() OVERRIDE;
90 107
91 FakeBluetoothAdapterClient* fake_bluetooth_adapter_client() {
92 return fake_bluetooth_adapter_client_.get();
93 }
94
95 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client() {
96 return fake_bluetooth_agent_manager_client_.get();
97 }
98
99 FakeBluetoothDeviceClient* fake_bluetooth_device_client() {
100 return fake_bluetooth_device_client_.get();
101 }
102
103 FakeBluetoothInputClient* fake_bluetooth_input_client() {
104 return fake_bluetooth_input_client_.get();
105 }
106
107 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client() {
108 return fake_bluetooth_profile_manager_client_.get();
109 }
110
111 FakeCrosDisksClient* fake_cros_disks_client() {
112 return fake_cros_disks_client_.get();
113 }
114
115 FakeCryptohomeClient* fake_cryptohome_client() {
116 return fake_cryptohome_client_.get();
117 }
118
119 FakeGsmSMSClient* fake_gsm_sms_client() {
120 return fake_gsm_sms_client_.get();
121 }
122
123 FakeImageBurnerClient* fake_image_burner_client() {
124 return fake_image_burner_client_.get();
125 }
126
127 FakeNfcAdapterClient* fake_nfc_adapter_client() {
128 return fake_nfc_adapter_client_.get();
129 }
130
131 FakeNfcDeviceClient* fake_nfc_device_client() {
132 return fake_nfc_device_client_.get();
133 }
134
135 FakeNfcManagerClient* fake_nfc_manager_client() {
136 return fake_nfc_manager_client_.get();
137 }
138
139 FakeNfcRecordClient* fake_nfc_record_client() {
140 return fake_nfc_record_client_.get();
141 }
142
143 FakeNfcTagClient* fake_nfc_tag_client() {
144 return fake_nfc_tag_client_.get();
145 }
146
147 FakeSessionManagerClient* fake_session_manager_client() {
148 return fake_session_manager_client_.get();
149 }
150
151 FakeShillDeviceClient* fake_shill_device_client() {
152 return fake_shill_device_client_.get();
153 }
154
155 FakeShillManagerClient* fake_shill_manager_client() {
156 return fake_shill_manager_client_.get();
157 }
158
159 FakeSystemClockClient* fake_system_clock_client() {
160 return fake_system_clock_client_.get();
161 }
162
163 FakePowerManagerClient* fake_power_manager_client() {
164 return fake_power_manager_client_.get();
165 }
166
167 FakeUpdateEngineClient* fake_update_engine_client() {
168 return fake_update_engine_client_.get();
169 }
170
171 // TODO(komatsu): Remove IBus related code. crbug.com/275262
172 MockIBusClient* mock_ibus_client() {
173 return mock_ibus_client_.get();
174 }
175
176 void set_ibus_bus(dbus::Bus* ibus_bus) {
177 ibus_bus_ = ibus_bus;
178 }
179
180 private: 108 private:
181 // Note: Keep this before other members so they can call AddObserver() in 109 // Note: Keep this before other members so they can call AddObserver() in
182 // their c'tors. 110 // their c'tors.
183 ObserverList<DBusThreadManagerObserver> observers_; 111 ObserverList<DBusThreadManagerObserver> observers_;
184 112
185 scoped_ptr<FakeBluetoothAdapterClient> fake_bluetooth_adapter_client_; 113 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
186 scoped_ptr<FakeBluetoothAgentManagerClient> 114 scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_;
187 fake_bluetooth_agent_manager_client_; 115 scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_;
188 scoped_ptr<FakeBluetoothDeviceClient> fake_bluetooth_device_client_; 116 scoped_ptr<BluetoothInputClient> bluetooth_input_client_;
189 scoped_ptr<FakeBluetoothInputClient> fake_bluetooth_input_client_; 117 scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_;
190 scoped_ptr<FakeBluetoothProfileManagerClient> 118 scoped_ptr<CrasAudioClient> cras_audio_client_;
191 fake_bluetooth_profile_manager_client_; 119 scoped_ptr<CrosDisksClient> cros_disks_client_;
192 scoped_ptr<FakeCrosDisksClient> fake_cros_disks_client_; 120 scoped_ptr<CryptohomeClient> cryptohome_client_;
193 scoped_ptr<FakeCryptohomeClient> fake_cryptohome_client_; 121 scoped_ptr<DebugDaemonClient> debug_daemon_client_;
194 scoped_ptr<FakeGsmSMSClient> fake_gsm_sms_client_; 122 scoped_ptr<ShillDeviceClient> shill_device_client_;
195 scoped_ptr<FakeImageBurnerClient> fake_image_burner_client_; 123 scoped_ptr<ShillIPConfigClient> shill_ipconfig_client_;
196 scoped_ptr<FakeNfcAdapterClient> fake_nfc_adapter_client_; 124 scoped_ptr<ShillManagerClient> shill_manager_client_;
197 scoped_ptr<FakeNfcDeviceClient> fake_nfc_device_client_; 125 scoped_ptr<ShillServiceClient> shill_service_client_;
198 scoped_ptr<FakeNfcManagerClient> fake_nfc_manager_client_; 126 scoped_ptr<ShillProfileClient> shill_profile_client_;
199 scoped_ptr<FakeNfcRecordClient> fake_nfc_record_client_; 127 scoped_ptr<GsmSMSClient> gsm_sms_client_;
200 scoped_ptr<FakeNfcTagClient> fake_nfc_tag_client_; 128 scoped_ptr<ImageBurnerClient> image_burner_client_;
201 scoped_ptr<FakeSessionManagerClient> fake_session_manager_client_; 129 scoped_ptr<IntrospectableClient> introspectable_client_;
202 scoped_ptr<FakeShillDeviceClient> fake_shill_device_client_; 130 scoped_ptr<ModemMessagingClient> modem_messaging_client_;
203 scoped_ptr<FakeShillManagerClient> fake_shill_manager_client_; 131 scoped_ptr<NfcAdapterClient> nfc_adapter_client_;
204 scoped_ptr<FakeSystemClockClient> fake_system_clock_client_; 132 scoped_ptr<NfcDeviceClient> nfc_device_client_;
205 scoped_ptr<FakePowerManagerClient> fake_power_manager_client_; 133 scoped_ptr<NfcManagerClient> nfc_manager_client_;
206 scoped_ptr<FakeUpdateEngineClient> fake_update_engine_client_; 134 scoped_ptr<NfcRecordClient> nfc_record_client_;
207 135 scoped_ptr<NfcTagClient> nfc_tag_client_;
208 scoped_ptr<MockIBusClient> mock_ibus_client_; 136 scoped_ptr<PermissionBrokerClient> permission_broker_client_;
137 scoped_ptr<SystemClockClient> system_clock_client_;
138 scoped_ptr<PowerManagerClient> power_manager_client_;
139 scoped_ptr<SessionManagerClient> session_manager_client_;
140 scoped_ptr<SMSClient> sms_client_;
141 scoped_ptr<UpdateEngineClient> update_engine_client_;
142 scoped_ptr<IBusClient> ibus_client_;
209 143
210 scoped_ptr<PowerPolicyController> power_policy_controller_; 144 scoped_ptr<PowerPolicyController> power_policy_controller_;
211 dbus::Bus* ibus_bus_;
212 145
213 DISALLOW_COPY_AND_ASSIGN(FakeDBusThreadManager); 146 DISALLOW_COPY_AND_ASSIGN(FakeDBusThreadManager);
214 }; 147 };
215 148
216 } // namespace chromeos 149 } // namespace chromeos
217 150
218 #endif // CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_ 151 #endif // CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/dbus_thread_manager.cc ('k') | chromeos/dbus/fake_dbus_thread_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698