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 DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ |
6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ | 6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 const ErrorCallback& error_callback); | 102 const ErrorCallback& error_callback); |
103 | 103 |
104 // BluetoothAdapter is supposed to manage the lifetime of BluetoothDevices. | 104 // BluetoothAdapter is supposed to manage the lifetime of BluetoothDevices. |
105 // This method takes ownership of the MockBluetoothDevice. This is only for | 105 // This method takes ownership of the MockBluetoothDevice. This is only for |
106 // convenience as far testing is concerned and it's possible to write test | 106 // convenience as far testing is concerned and it's possible to write test |
107 // cases without using these functions. | 107 // cases without using these functions. |
108 void AddMockDevice(scoped_ptr<MockBluetoothDevice> mock_device); | 108 void AddMockDevice(scoped_ptr<MockBluetoothDevice> mock_device); |
109 BluetoothAdapter::ConstDeviceList GetConstMockDevices(); | 109 BluetoothAdapter::ConstDeviceList GetConstMockDevices(); |
110 BluetoothAdapter::DeviceList GetMockDevices(); | 110 BluetoothAdapter::DeviceList GetMockDevices(); |
111 | 111 |
| 112 // The observers are maintained by the default behavior of AddObserver() and |
| 113 // RemoveObserver(). Test fakes can use this function to notify the observers |
| 114 // about events. |
| 115 base::ObserverList<device::BluetoothAdapter::Observer>& GetObservers() { |
| 116 return observers_; |
| 117 } |
| 118 |
112 protected: | 119 protected: |
113 void AddDiscoverySession( | 120 void AddDiscoverySession( |
114 BluetoothDiscoveryFilter* discovery_filter, | 121 BluetoothDiscoveryFilter* discovery_filter, |
115 const base::Closure& callback, | 122 const base::Closure& callback, |
116 const DiscoverySessionErrorCallback& error_callback) override; | 123 const DiscoverySessionErrorCallback& error_callback) override; |
117 void RemoveDiscoverySession( | 124 void RemoveDiscoverySession( |
118 BluetoothDiscoveryFilter* discovery_filter, | 125 BluetoothDiscoveryFilter* discovery_filter, |
119 const base::Closure& callback, | 126 const base::Closure& callback, |
120 const DiscoverySessionErrorCallback& error_callback) override; | 127 const DiscoverySessionErrorCallback& error_callback) override; |
121 void SetDiscoveryFilter( | 128 void SetDiscoveryFilter( |
122 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter, | 129 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter, |
123 const base::Closure& callback, | 130 const base::Closure& callback, |
124 const DiscoverySessionErrorCallback& error_callback) override; | 131 const DiscoverySessionErrorCallback& error_callback) override; |
125 void RegisterAdvertisement( | 132 void RegisterAdvertisement( |
126 scoped_ptr<BluetoothAdvertisement::Data> advertisement_data, | 133 scoped_ptr<BluetoothAdvertisement::Data> advertisement_data, |
127 const CreateAdvertisementCallback& callback, | 134 const CreateAdvertisementCallback& callback, |
128 const CreateAdvertisementErrorCallback& error_callback) override; | 135 const CreateAdvertisementErrorCallback& error_callback) override; |
129 virtual ~MockBluetoothAdapter(); | 136 virtual ~MockBluetoothAdapter(); |
130 | 137 |
131 MOCK_METHOD1(RemovePairingDelegateInternal, | 138 MOCK_METHOD1(RemovePairingDelegateInternal, |
132 void(BluetoothDevice::PairingDelegate* pairing_delegate)); | 139 void(BluetoothDevice::PairingDelegate* pairing_delegate)); |
133 | 140 |
134 ScopedVector<MockBluetoothDevice> mock_devices_; | 141 ScopedVector<MockBluetoothDevice> mock_devices_; |
135 }; | 142 }; |
136 | 143 |
137 } // namespace device | 144 } // namespace device |
138 | 145 |
139 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ | 146 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ |
OLD | NEW |