• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_
6 #define CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_
7 
8 #include <string>
9 
10 #include "base/logging.h"
11 #include "base/observer_list.h"
12 #include "chromeos/chromeos_export.h"
13 #include "chromeos/dbus/dbus_thread_manager.h"
14 
15 namespace dbus {
16 class Bus;
17 class ObjectPath;
18 }  // namespace dbus
19 
20 namespace chromeos {
21 
22 class DBusThreadManagerObserver;
23 
24 // This class provides a fake implementation of DBusThreadManager, which
25 // hosts fake D-Bus clients.
26 class CHROMEOS_EXPORT FakeDBusThreadManager : public DBusThreadManager {
27  public:
28   FakeDBusThreadManager();
29   virtual ~FakeDBusThreadManager();
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 
67   virtual void AddObserver(DBusThreadManagerObserver* observer) OVERRIDE;
68   virtual void RemoveObserver(DBusThreadManagerObserver* observer) OVERRIDE;
69   virtual dbus::Bus* GetSystemBus() OVERRIDE;
70 
71   virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE;
72   virtual BluetoothAgentManagerClient*
73       GetBluetoothAgentManagerClient() OVERRIDE;
74   virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE;
75   virtual BluetoothInputClient* GetBluetoothInputClient() OVERRIDE;
76   virtual BluetoothProfileManagerClient*
77       GetBluetoothProfileManagerClient() OVERRIDE;
78   virtual CrasAudioClient* GetCrasAudioClient() OVERRIDE;
79   virtual CrosDisksClient* GetCrosDisksClient() OVERRIDE;
80   virtual CryptohomeClient* GetCryptohomeClient() OVERRIDE;
81   virtual DebugDaemonClient* GetDebugDaemonClient() OVERRIDE;
82   virtual ShillDeviceClient* GetShillDeviceClient() OVERRIDE;
83   virtual ShillIPConfigClient* GetShillIPConfigClient() OVERRIDE;
84   virtual ShillManagerClient* GetShillManagerClient() OVERRIDE;
85   virtual ShillProfileClient* GetShillProfileClient() OVERRIDE;
86   virtual ShillServiceClient* GetShillServiceClient() OVERRIDE;
87   virtual GsmSMSClient* GetGsmSMSClient() OVERRIDE;
88   virtual ImageBurnerClient* GetImageBurnerClient() OVERRIDE;
89   virtual IntrospectableClient* GetIntrospectableClient() OVERRIDE;
90   virtual ModemMessagingClient* GetModemMessagingClient() OVERRIDE;
91   virtual NfcAdapterClient* GetNfcAdapterClient() OVERRIDE;
92   virtual NfcDeviceClient* GetNfcDeviceClient() OVERRIDE;
93   virtual NfcManagerClient* GetNfcManagerClient() OVERRIDE;
94   virtual NfcRecordClient* GetNfcRecordClient() OVERRIDE;
95   virtual NfcTagClient* GetNfcTagClient() OVERRIDE;
96   virtual PermissionBrokerClient* GetPermissionBrokerClient() OVERRIDE;
97   virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE;
98   virtual PowerPolicyController* GetPowerPolicyController() OVERRIDE;
99   virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE;
100   virtual SMSClient* GetSMSClient() OVERRIDE;
101   virtual SystemClockClient* GetSystemClockClient() OVERRIDE;
102   virtual UpdateEngineClient* GetUpdateEngineClient() OVERRIDE;
103 
104  private:
105   // Note: Keep this before other members so they can call AddObserver() in
106   // their c'tors.
107   ObserverList<DBusThreadManagerObserver> observers_;
108 
109   scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
110   scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_;
111   scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_;
112   scoped_ptr<BluetoothInputClient> bluetooth_input_client_;
113   scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_;
114   scoped_ptr<CrasAudioClient> cras_audio_client_;
115   scoped_ptr<CrosDisksClient> cros_disks_client_;
116   scoped_ptr<CryptohomeClient> cryptohome_client_;
117   scoped_ptr<DebugDaemonClient> debug_daemon_client_;
118   scoped_ptr<ShillDeviceClient> shill_device_client_;
119   scoped_ptr<ShillIPConfigClient> shill_ipconfig_client_;
120   scoped_ptr<ShillManagerClient> shill_manager_client_;
121   scoped_ptr<ShillServiceClient> shill_service_client_;
122   scoped_ptr<ShillProfileClient> shill_profile_client_;
123   scoped_ptr<GsmSMSClient> gsm_sms_client_;
124   scoped_ptr<ImageBurnerClient> image_burner_client_;
125   scoped_ptr<IntrospectableClient> introspectable_client_;
126   scoped_ptr<ModemMessagingClient> modem_messaging_client_;
127   scoped_ptr<NfcAdapterClient> nfc_adapter_client_;
128   scoped_ptr<NfcDeviceClient> nfc_device_client_;
129   scoped_ptr<NfcManagerClient> nfc_manager_client_;
130   scoped_ptr<NfcRecordClient> nfc_record_client_;
131   scoped_ptr<NfcTagClient> nfc_tag_client_;
132   scoped_ptr<PermissionBrokerClient> permission_broker_client_;
133   scoped_ptr<SystemClockClient> system_clock_client_;
134   scoped_ptr<PowerManagerClient> power_manager_client_;
135   scoped_ptr<SessionManagerClient> session_manager_client_;
136   scoped_ptr<SMSClient> sms_client_;
137   scoped_ptr<UpdateEngineClient> update_engine_client_;
138 
139   scoped_ptr<PowerPolicyController> power_policy_controller_;
140 
141   DISALLOW_COPY_AND_ASSIGN(FakeDBusThreadManager);
142 };
143 
144 }  // namespace chromeos
145 
146 #endif  // CHROMEOS_DBUS_FAKE_DBUS_THREAD_MANAGER_H_
147