| OLD | NEW |
| (Empty) |
| 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_MOCK_DBUS_THREAD_MANAGER_H_ | |
| 6 #define CHROMEOS_DBUS_MOCK_DBUS_THREAD_MANAGER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/observer_list.h" | |
| 11 #include "chromeos/dbus/dbus_thread_manager.h" | |
| 12 #include "testing/gmock/include/gmock/gmock.h" | |
| 13 | |
| 14 namespace dbus { | |
| 15 | |
| 16 class Bus; | |
| 17 | |
| 18 } // namespace dbus | |
| 19 | |
| 20 namespace chromeos { | |
| 21 | |
| 22 class DBusThreadManagerObserver; | |
| 23 class FakeBluetoothAdapterClient; | |
| 24 class FakeBluetoothAgentManagerClient; | |
| 25 class FakeBluetoothDeviceClient; | |
| 26 class FakeBluetoothInputClient; | |
| 27 class FakeBluetoothProfileManagerClient; | |
| 28 class FakeGsmSMSClient; | |
| 29 class FakeNfcAdapterClient; | |
| 30 class FakeNfcDeviceClient; | |
| 31 class FakeNfcManagerClient; | |
| 32 class FakeNfcRecordClient; | |
| 33 class FakeNfcTagClient; | |
| 34 class FakeShillDeviceClient; | |
| 35 class FakeShillIPConfigClient; | |
| 36 class MockCryptohomeClient; | |
| 37 class MockPowerManagerClient; | |
| 38 class MockSessionManagerClient; | |
| 39 class MockShillManagerClient; | |
| 40 class MockShillProfileClient; | |
| 41 class MockShillServiceClient; | |
| 42 | |
| 43 // This class provides a mock DBusThreadManager with mock clients | |
| 44 // installed. You can customize the behaviors of mock clients with | |
| 45 // mock_foo_client() functions. | |
| 46 // Please avoid adding more GMock in this class. We have an ongoing effort to | |
| 47 // remove GMock dependency. TODO(haruki): crbug.com/223061. | |
| 48 class MockDBusThreadManager : public DBusThreadManager { | |
| 49 public: | |
| 50 MockDBusThreadManager(); | |
| 51 virtual ~MockDBusThreadManager(); | |
| 52 | |
| 53 void AddObserver(DBusThreadManagerObserver* observer) OVERRIDE; | |
| 54 void RemoveObserver(DBusThreadManagerObserver* observer) OVERRIDE; | |
| 55 MOCK_METHOD2(InitIBusBus, void(const std::string& ibus_address, | |
| 56 const base::Closure& closure)); | |
| 57 MOCK_METHOD0(GetSystemBus, dbus::Bus*(void)); | |
| 58 MOCK_METHOD0(GetBluetoothAdapterClient, BluetoothAdapterClient*(void)); | |
| 59 MOCK_METHOD0(GetBluetoothAgentManagerClient, | |
| 60 BluetoothAgentManagerClient*(void)); | |
| 61 MOCK_METHOD0(GetBluetoothDeviceClient, BluetoothDeviceClient*(void)); | |
| 62 MOCK_METHOD0(GetBluetoothInputClient, BluetoothInputClient*(void)); | |
| 63 MOCK_METHOD0(GetBluetoothProfileManagerClient, | |
| 64 BluetoothProfileManagerClient*(void)); | |
| 65 MOCK_METHOD0(GetCrasAudioClient, CrasAudioClient*(void)); | |
| 66 MOCK_METHOD0(GetCrosDisksClient, CrosDisksClient*(void)); | |
| 67 MOCK_METHOD0(GetCryptohomeClient, CryptohomeClient*(void)); | |
| 68 MOCK_METHOD0(GetDebugDaemonClient, DebugDaemonClient*(void)); | |
| 69 MOCK_METHOD0(GetShillDeviceClient, ShillDeviceClient*(void)); | |
| 70 MOCK_METHOD0(GetShillIPConfigClient, ShillIPConfigClient*(void)); | |
| 71 MOCK_METHOD0(GetShillManagerClient, ShillManagerClient*(void)); | |
| 72 MOCK_METHOD0(GetShillProfileClient, ShillProfileClient*(void)); | |
| 73 MOCK_METHOD0(GetShillServiceClient, ShillServiceClient*(void)); | |
| 74 MOCK_METHOD0(GetGsmSMSClient, GsmSMSClient*(void)); | |
| 75 MOCK_METHOD0(GetImageBurnerClient, ImageBurnerClient*(void)); | |
| 76 MOCK_METHOD0(GetIntrospectableClient, IntrospectableClient*(void)); | |
| 77 MOCK_METHOD0(GetModemMessagingClient, ModemMessagingClient*(void)); | |
| 78 MOCK_METHOD0(GetNfcAdapterClient, NfcAdapterClient*(void)); | |
| 79 MOCK_METHOD0(GetNfcDeviceClient, NfcDeviceClient*(void)); | |
| 80 MOCK_METHOD0(GetNfcManagerClient, NfcManagerClient*(void)); | |
| 81 MOCK_METHOD0(GetNfcRecordClient, NfcRecordClient*(void)); | |
| 82 MOCK_METHOD0(GetNfcTagClient, NfcTagClient*(void)); | |
| 83 MOCK_METHOD0(GetPermissionBrokerClient, PermissionBrokerClient*(void)); | |
| 84 MOCK_METHOD0(GetPowerManagerClient, PowerManagerClient*(void)); | |
| 85 MOCK_METHOD0(GetPowerPolicyController, PowerPolicyController*(void)); | |
| 86 MOCK_METHOD0(GetSessionManagerClient, SessionManagerClient*(void)); | |
| 87 MOCK_METHOD0(GetSMSClient, SMSClient*(void)); | |
| 88 MOCK_METHOD0(GetSystemClockClient, SystemClockClient*(void)); | |
| 89 MOCK_METHOD0(GetUpdateEngineClient, UpdateEngineClient*(void)); | |
| 90 MOCK_METHOD0(GetIBusClient, IBusClient*(void)); | |
| 91 | |
| 92 FakeBluetoothAdapterClient* fake_bluetooth_adapter_client() { | |
| 93 return fake_bluetooth_adapter_client_.get(); | |
| 94 } | |
| 95 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client() { | |
| 96 return fake_bluetooth_agent_manager_client_.get(); | |
| 97 } | |
| 98 FakeBluetoothDeviceClient* fake_bluetooth_device_client() { | |
| 99 return fake_bluetooth_device_client_.get(); | |
| 100 } | |
| 101 FakeBluetoothInputClient* fake_bluetooth_input_client() { | |
| 102 return fake_bluetooth_input_client_.get(); | |
| 103 } | |
| 104 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client() { | |
| 105 return fake_bluetooth_profile_manager_client_.get(); | |
| 106 } | |
| 107 FakeGsmSMSClient* fake_gsm_sms_client() { | |
| 108 return fake_gsm_sms_client_.get(); | |
| 109 } | |
| 110 FakeNfcAdapterClient* fake_nfc_adapter_client() { | |
| 111 return fake_nfc_adapter_client_.get(); | |
| 112 } | |
| 113 FakeNfcDeviceClient* fake_nfc_device_client() { | |
| 114 return fake_nfc_device_client_.get(); | |
| 115 } | |
| 116 FakeNfcManagerClient* fake_nfc_manager_client() { | |
| 117 return fake_nfc_manager_client_.get(); | |
| 118 } | |
| 119 FakeNfcRecordClient* fake_nfc_record_client() { | |
| 120 return fake_nfc_record_client_.get(); | |
| 121 } | |
| 122 FakeNfcTagClient* fake_nfc_tag_client() { | |
| 123 return fake_nfc_tag_client_.get(); | |
| 124 } | |
| 125 FakeShillDeviceClient* fake_shill_device_client() { | |
| 126 return fake_shill_device_client_.get(); | |
| 127 } | |
| 128 FakeShillIPConfigClient* fake_shill_ipconfig_client() { | |
| 129 return fake_shill_ipconfig_client_.get(); | |
| 130 } | |
| 131 MockCryptohomeClient* mock_cryptohome_client() { | |
| 132 return mock_cryptohome_client_.get(); | |
| 133 } | |
| 134 MockShillManagerClient* mock_shill_manager_client() { | |
| 135 return mock_shill_manager_client_.get(); | |
| 136 } | |
| 137 MockShillProfileClient* mock_shill_profile_client() { | |
| 138 return mock_shill_profile_client_.get(); | |
| 139 } | |
| 140 MockShillServiceClient* mock_shill_service_client() { | |
| 141 return mock_shill_service_client_.get(); | |
| 142 } | |
| 143 MockSessionManagerClient* mock_session_manager_client() { | |
| 144 return mock_session_manager_client_.get(); | |
| 145 } | |
| 146 | |
| 147 private: | |
| 148 // Note: Keep this before other members so they can call AddObserver() in | |
| 149 // their c'tors. | |
| 150 ObserverList<DBusThreadManagerObserver> observers_; | |
| 151 | |
| 152 scoped_ptr<FakeBluetoothAdapterClient> fake_bluetooth_adapter_client_; | |
| 153 scoped_ptr<FakeBluetoothAgentManagerClient> | |
| 154 fake_bluetooth_agent_manager_client_; | |
| 155 scoped_ptr<FakeBluetoothDeviceClient> fake_bluetooth_device_client_; | |
| 156 scoped_ptr<FakeBluetoothInputClient> fake_bluetooth_input_client_; | |
| 157 scoped_ptr<FakeBluetoothProfileManagerClient> | |
| 158 fake_bluetooth_profile_manager_client_; | |
| 159 scoped_ptr<FakeGsmSMSClient> fake_gsm_sms_client_; | |
| 160 scoped_ptr<FakeNfcAdapterClient> fake_nfc_adapter_client_; | |
| 161 scoped_ptr<FakeNfcDeviceClient> fake_nfc_device_client_; | |
| 162 scoped_ptr<FakeNfcManagerClient> fake_nfc_manager_client_; | |
| 163 scoped_ptr<FakeNfcRecordClient> fake_nfc_record_client_; | |
| 164 scoped_ptr<FakeNfcTagClient> fake_nfc_tag_client_; | |
| 165 scoped_ptr<FakeShillDeviceClient> fake_shill_device_client_; | |
| 166 scoped_ptr<FakeShillIPConfigClient> fake_shill_ipconfig_client_; | |
| 167 scoped_ptr<MockCryptohomeClient> mock_cryptohome_client_; | |
| 168 scoped_ptr<MockShillManagerClient> mock_shill_manager_client_; | |
| 169 scoped_ptr<MockShillProfileClient> mock_shill_profile_client_; | |
| 170 scoped_ptr<MockShillServiceClient> mock_shill_service_client_; | |
| 171 scoped_ptr<MockSessionManagerClient> mock_session_manager_client_; | |
| 172 | |
| 173 DISALLOW_COPY_AND_ASSIGN(MockDBusThreadManager); | |
| 174 }; | |
| 175 | |
| 176 } // namespace chromeos | |
| 177 | |
| 178 #endif // CHROMEOS_DBUS_MOCK_DBUS_THREAD_MANAGER_H_ | |
| OLD | NEW |