// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_ #define CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_ #include #include "base/logging.h" #include "base/observer_list.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_thread_manager.h" namespace dbus { class Bus; class ObjectPath; } // namespace dbus namespace chromeos { class DBusThreadManagerObserver; // This class provides a fake implementation of DBusThreadManager, which // hosts fake D-Bus clients. class CHROMEOS_EXPORT FakeDBusThreadManager : public DBusThreadManager { public: FakeDBusThreadManager(); virtual ~FakeDBusThreadManager(); // Creates and sets all fake DBusClients and the PowerPolicyController. void SetFakeClients(); // Creates and sets all fake Shill DBusClients. void SetFakeShillClients(); // Sets up any default environment for fake clients, e.g. for UI testing. void SetupDefaultEnvironment(); void SetBluetoothAdapterClient(scoped_ptr client); void SetBluetoothAgentManagerClient( scoped_ptr client); void SetBluetoothDeviceClient(scoped_ptr client); void SetBluetoothGattCharacteristicClient( scoped_ptr client); void SetBluetoothGattDescriptorClient( scoped_ptr client); void SetBluetoothGattManagerClient( scoped_ptr client); void SetBluetoothGattServiceClient( scoped_ptr client); void SetBluetoothInputClient(scoped_ptr client); void SetBluetoothProfileManagerClient( scoped_ptr client); void SetCrasAudioClient(scoped_ptr client); void SetCrosDisksClient(scoped_ptr client); void SetCryptohomeClient(scoped_ptr client); void SetDebugDaemonClient(scoped_ptr client); void SetLorgnetteManagerClient(scoped_ptr client); void SetShillDeviceClient(scoped_ptr client); void SetShillIPConfigClient(scoped_ptr client); void SetShillManagerClient(scoped_ptr client); void SetShillServiceClient(scoped_ptr client); void SetShillProfileClient(scoped_ptr client); void SetGsmSMSClient(scoped_ptr client); void SetImageBurnerClient(scoped_ptr client); void SetIntrospectableClient(scoped_ptr client); void SetModemMessagingClient(scoped_ptr client); void SetNfcAdapterClient(scoped_ptr client); void SetNfcDeviceClient(scoped_ptr client); void SetNfcManagerClient(scoped_ptr client); void SetNfcRecordClient(scoped_ptr client); void SetNfcTagClient(scoped_ptr client); void SetPermissionBrokerClient(scoped_ptr client); void SetPowerManagerClient(scoped_ptr client); void SetPowerPolicyController(scoped_ptr client); void SetSessionManagerClient(scoped_ptr client); void SetSMSClient(scoped_ptr client); void SetSystemClockClient(scoped_ptr client); void SetUpdateEngineClient(scoped_ptr client); virtual void AddObserver(DBusThreadManagerObserver* observer) OVERRIDE; virtual void RemoveObserver(DBusThreadManagerObserver* observer) OVERRIDE; virtual dbus::Bus* GetSystemBus() OVERRIDE; virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE; virtual BluetoothAgentManagerClient* GetBluetoothAgentManagerClient() OVERRIDE; virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE; virtual BluetoothGattCharacteristicClient* GetBluetoothGattCharacteristicClient() OVERRIDE; virtual BluetoothGattDescriptorClient* GetBluetoothGattDescriptorClient() OVERRIDE; virtual BluetoothGattManagerClient* GetBluetoothGattManagerClient() OVERRIDE; virtual BluetoothGattServiceClient* GetBluetoothGattServiceClient() OVERRIDE; virtual BluetoothInputClient* GetBluetoothInputClient() OVERRIDE; virtual BluetoothProfileManagerClient* GetBluetoothProfileManagerClient() OVERRIDE; virtual CrasAudioClient* GetCrasAudioClient() OVERRIDE; virtual CrosDisksClient* GetCrosDisksClient() OVERRIDE; virtual CryptohomeClient* GetCryptohomeClient() OVERRIDE; virtual DebugDaemonClient* GetDebugDaemonClient() OVERRIDE; virtual LorgnetteManagerClient* GetLorgnetteManagerClient() OVERRIDE; virtual ShillDeviceClient* GetShillDeviceClient() OVERRIDE; virtual ShillIPConfigClient* GetShillIPConfigClient() OVERRIDE; virtual ShillManagerClient* GetShillManagerClient() OVERRIDE; virtual ShillProfileClient* GetShillProfileClient() OVERRIDE; virtual ShillServiceClient* GetShillServiceClient() OVERRIDE; virtual GsmSMSClient* GetGsmSMSClient() OVERRIDE; virtual ImageBurnerClient* GetImageBurnerClient() OVERRIDE; virtual IntrospectableClient* GetIntrospectableClient() OVERRIDE; virtual ModemMessagingClient* GetModemMessagingClient() OVERRIDE; virtual NfcAdapterClient* GetNfcAdapterClient() OVERRIDE; virtual NfcDeviceClient* GetNfcDeviceClient() OVERRIDE; virtual NfcManagerClient* GetNfcManagerClient() OVERRIDE; virtual NfcRecordClient* GetNfcRecordClient() OVERRIDE; virtual NfcTagClient* GetNfcTagClient() OVERRIDE; virtual PermissionBrokerClient* GetPermissionBrokerClient() OVERRIDE; virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE; virtual PowerPolicyController* GetPowerPolicyController() OVERRIDE; virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE; virtual SMSClient* GetSMSClient() OVERRIDE; virtual SystemClockClient* GetSystemClockClient() OVERRIDE; virtual UpdateEngineClient* GetUpdateEngineClient() OVERRIDE; private: // Note: Keep this before other members so they can call AddObserver() in // their c'tors. ObserverList observers_; scoped_ptr bluetooth_adapter_client_; scoped_ptr bluetooth_agent_manager_client_; scoped_ptr bluetooth_device_client_; scoped_ptr bluetooth_gatt_characteristic_client_; scoped_ptr bluetooth_gatt_descriptor_client_; scoped_ptr bluetooth_gatt_manager_client_; scoped_ptr bluetooth_gatt_service_client_; scoped_ptr bluetooth_input_client_; scoped_ptr bluetooth_profile_manager_client_; scoped_ptr cras_audio_client_; scoped_ptr cros_disks_client_; scoped_ptr cryptohome_client_; scoped_ptr debug_daemon_client_; scoped_ptr lorgnette_manager_client_; scoped_ptr shill_device_client_; scoped_ptr shill_ipconfig_client_; scoped_ptr shill_manager_client_; scoped_ptr shill_service_client_; scoped_ptr shill_profile_client_; scoped_ptr gsm_sms_client_; scoped_ptr image_burner_client_; scoped_ptr introspectable_client_; scoped_ptr modem_messaging_client_; scoped_ptr nfc_adapter_client_; scoped_ptr nfc_device_client_; scoped_ptr nfc_manager_client_; scoped_ptr nfc_record_client_; scoped_ptr nfc_tag_client_; scoped_ptr permission_broker_client_; scoped_ptr system_clock_client_; scoped_ptr power_manager_client_; scoped_ptr session_manager_client_; scoped_ptr sms_client_; scoped_ptr update_engine_client_; scoped_ptr power_policy_controller_; DISALLOW_COPY_AND_ASSIGN(FakeDBusThreadManager); }; } // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_