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