| 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 <memory> | 10 #include <memory> |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 247 |
| 248 // Simulates write a value to a locally hosted GATT descriptor by a | 248 // Simulates write a value to a locally hosted GATT descriptor by a |
| 249 // remote central device. | 249 // remote central device. |
| 250 virtual void SimulateLocalGattDescriptorValueWriteRequest( | 250 virtual void SimulateLocalGattDescriptorValueWriteRequest( |
| 251 BluetoothLocalGattService* service, | 251 BluetoothLocalGattService* service, |
| 252 BluetoothLocalGattDescriptor* descriptor, | 252 BluetoothLocalGattDescriptor* descriptor, |
| 253 const std::vector<uint8_t>& value_to_write, | 253 const std::vector<uint8_t>& value_to_write, |
| 254 const base::Closure& success_callback, | 254 const base::Closure& success_callback, |
| 255 const base::Closure& error_callback) {} | 255 const base::Closure& error_callback) {} |
| 256 | 256 |
| 257 // Simulates starting or stopping a notification session for a locally |
| 258 // hosted GATT characteristic by a remote device. Returns false if we were |
| 259 // not able to start or stop notifications. |
| 260 virtual bool SimulateLocalGattCharacteristicNotificationsRequest( |
| 261 BluetoothLocalGattService* service, |
| 262 BluetoothLocalGattCharacteristic* characteristic, |
| 263 bool start); |
| 264 |
| 265 // Returns the value for the last notification that was sent on this |
| 266 // characteristic. |
| 267 virtual std::vector<uint8_t> LastNotifactionValueForCharacteristic( |
| 268 BluetoothLocalGattCharacteristic* characteristic); |
| 269 |
| 257 // Remembers |descriptor|'s platform specific object to be used in a | 270 // Remembers |descriptor|'s platform specific object to be used in a |
| 258 // subsequent call to methods such as SimulateGattDescriptorRead that | 271 // subsequent call to methods such as SimulateGattDescriptorRead that |
| 259 // accept a nullptr value to select this remembered descriptor. This | 272 // accept a nullptr value to select this remembered descriptor. This |
| 260 // enables tests where the platform attempts to reference descriptor | 273 // enables tests where the platform attempts to reference descriptor |
| 261 // objects after the Chrome objects have been deleted, e.g. with DeleteDevice. | 274 // objects after the Chrome objects have been deleted, e.g. with DeleteDevice. |
| 262 virtual void RememberDescriptorForSubsequentAction( | 275 virtual void RememberDescriptorForSubsequentAction( |
| 263 BluetoothRemoteGattDescriptor* descriptor) {} | 276 BluetoothRemoteGattDescriptor* descriptor) {} |
| 264 | 277 |
| 265 // Simulates a Descriptor Read operation succeeding, returning |value|. | 278 // Simulates a Descriptor Read operation succeeding, returning |value|. |
| 266 // If |descriptor| is null, acts upon the descriptor provided to | 279 // If |descriptor| is null, acts upon the descriptor provided to |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 int actual_error_callback_calls_ = 0; | 398 int actual_error_callback_calls_ = 0; |
| 386 bool unexpected_success_callback_ = false; | 399 bool unexpected_success_callback_ = false; |
| 387 bool unexpected_error_callback_ = false; | 400 bool unexpected_error_callback_ = false; |
| 388 | 401 |
| 389 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 402 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
| 390 }; | 403 }; |
| 391 | 404 |
| 392 } // namespace device | 405 } // namespace device |
| 393 | 406 |
| 394 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 407 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
| OLD | NEW |