| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_BLUETOOTH_TEST_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
| 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 // Simulates a Characteristic Set Notify success. | 140 // Simulates a Characteristic Set Notify success. |
| 141 virtual void SimulateGattNotifySessionStarted( | 141 virtual void SimulateGattNotifySessionStarted( |
| 142 BluetoothGattCharacteristic* characteristic) {} | 142 BluetoothGattCharacteristic* characteristic) {} |
| 143 | 143 |
| 144 // Simulates a Characteristic Set Notify operation failing synchronously once | 144 // Simulates a Characteristic Set Notify operation failing synchronously once |
| 145 // for an unknown reason. | 145 // for an unknown reason. |
| 146 virtual void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( | 146 virtual void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( |
| 147 BluetoothGattCharacteristic* characteristic) {} | 147 BluetoothGattCharacteristic* characteristic) {} |
| 148 | 148 |
| 149 // Simulates a Characteristic Set Notify operation failing asynchronously once |
| 150 // for an unknown reason. |
| 151 virtual void SimulateGattCharacteristicSetNotifyWillFailAsynchronouslyOnce( |
| 152 BluetoothGattCharacteristic* characteristic) {} |
| 153 |
| 149 // Simulates a Characteristic Changed operation with updated |value|. | 154 // Simulates a Characteristic Changed operation with updated |value|. |
| 150 virtual void SimulateGattCharacteristicChanged( | 155 virtual void SimulateGattCharacteristicChanged( |
| 151 BluetoothGattCharacteristic* characteristic, | 156 BluetoothGattCharacteristic* characteristic, |
| 152 const std::vector<uint8_t>& value) {} | 157 const std::vector<uint8_t>& value) {} |
| 153 | 158 |
| 154 // Simulates a Characteristic Read operation succeeding, returning |value|. | 159 // Simulates a Characteristic Read operation succeeding, returning |value|. |
| 155 // If |characteristic| is null, acts upon the characteristic provided to | 160 // If |characteristic| is null, acts upon the characteristic provided to |
| 156 // RememberCharacteristicForSubsequentAction. | 161 // RememberCharacteristicForSubsequentAction. |
| 157 virtual void SimulateGattCharacteristicRead( | 162 virtual void SimulateGattCharacteristicRead( |
| 158 BluetoothGattCharacteristic* characteristic, | 163 BluetoothGattCharacteristic* characteristic, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 void DiscoverySessionCallback(Call expected, | 242 void DiscoverySessionCallback(Call expected, |
| 238 scoped_ptr<BluetoothDiscoverySession>); | 243 scoped_ptr<BluetoothDiscoverySession>); |
| 239 void GattConnectionCallback(Call expected, | 244 void GattConnectionCallback(Call expected, |
| 240 scoped_ptr<BluetoothGattConnection>); | 245 scoped_ptr<BluetoothGattConnection>); |
| 241 void NotifyCallback(Call expected, scoped_ptr<BluetoothGattNotifySession>); | 246 void NotifyCallback(Call expected, scoped_ptr<BluetoothGattNotifySession>); |
| 242 void ReadValueCallback(Call expected, const std::vector<uint8_t>& value); | 247 void ReadValueCallback(Call expected, const std::vector<uint8_t>& value); |
| 243 void ErrorCallback(Call expected); | 248 void ErrorCallback(Call expected); |
| 244 void ConnectErrorCallback(Call expected, | 249 void ConnectErrorCallback(Call expected, |
| 245 enum BluetoothDevice::ConnectErrorCode); | 250 enum BluetoothDevice::ConnectErrorCode); |
| 246 void GattErrorCallback(Call expected, BluetoothGattService::GattErrorCode); | 251 void GattErrorCallback(Call expected, BluetoothGattService::GattErrorCode); |
| 252 void ReentrantStartNotifySessionErrorCallback( |
| 253 Call expected, |
| 254 BluetoothGattCharacteristic* characteristic, |
| 255 BluetoothGattService::GattErrorCode error_code); |
| 247 | 256 |
| 248 // Accessors to get callbacks bound to this fixture: | 257 // Accessors to get callbacks bound to this fixture: |
| 249 base::Closure GetCallback(Call expected); | 258 base::Closure GetCallback(Call expected); |
| 250 BluetoothAdapter::DiscoverySessionCallback GetDiscoverySessionCallback( | 259 BluetoothAdapter::DiscoverySessionCallback GetDiscoverySessionCallback( |
| 251 Call expected); | 260 Call expected); |
| 252 BluetoothDevice::GattConnectionCallback GetGattConnectionCallback( | 261 BluetoothDevice::GattConnectionCallback GetGattConnectionCallback( |
| 253 Call expected); | 262 Call expected); |
| 254 BluetoothGattCharacteristic::NotifySessionCallback GetNotifyCallback( | 263 BluetoothGattCharacteristic::NotifySessionCallback GetNotifyCallback( |
| 255 Call expected); | 264 Call expected); |
| 256 BluetoothGattCharacteristic::ValueCallback GetReadValueCallback( | 265 BluetoothGattCharacteristic::ValueCallback GetReadValueCallback( |
| 257 Call expected); | 266 Call expected); |
| 258 BluetoothAdapter::ErrorCallback GetErrorCallback(Call expected); | 267 BluetoothAdapter::ErrorCallback GetErrorCallback(Call expected); |
| 259 BluetoothDevice::ConnectErrorCallback GetConnectErrorCallback(Call expected); | 268 BluetoothDevice::ConnectErrorCallback GetConnectErrorCallback(Call expected); |
| 260 base::Callback<void(BluetoothGattService::GattErrorCode)> | 269 base::Callback<void(BluetoothGattService::GattErrorCode)> |
| 261 GetGattErrorCallback(Call expected); | 270 GetGattErrorCallback(Call expected); |
| 271 base::Callback<void(BluetoothGattService::GattErrorCode)> |
| 272 GetReentrantStartNotifySessionErrorCallback( |
| 273 Call expected, |
| 274 BluetoothGattCharacteristic* characteristic); |
| 262 | 275 |
| 263 // Reset all event count members to 0. | 276 // Reset all event count members to 0. |
| 264 void ResetEventCounts(); | 277 void ResetEventCounts(); |
| 265 | 278 |
| 266 // A Message loop is required by some implementations that will PostTasks and | 279 // A Message loop is required by some implementations that will PostTasks and |
| 267 // by base::RunLoop().RunUntilIdle() use in this fixture. | 280 // by base::RunLoop().RunUntilIdle() use in this fixture. |
| 268 base::MessageLoop message_loop_; | 281 base::MessageLoop message_loop_; |
| 269 | 282 |
| 270 scoped_refptr<BluetoothAdapter> adapter_; | 283 scoped_refptr<BluetoothAdapter> adapter_; |
| 271 ScopedVector<BluetoothDiscoverySession> discovery_sessions_; | 284 ScopedVector<BluetoothDiscoverySession> discovery_sessions_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 296 int actual_error_callback_calls_ = 0; | 309 int actual_error_callback_calls_ = 0; |
| 297 bool unexpected_success_callback_ = false; | 310 bool unexpected_success_callback_ = false; |
| 298 bool unexpected_error_callback_ = false; | 311 bool unexpected_error_callback_ = false; |
| 299 | 312 |
| 300 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 313 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
| 301 }; | 314 }; |
| 302 | 315 |
| 303 } // namespace device | 316 } // namespace device |
| 304 | 317 |
| 305 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 318 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
| OLD | NEW |