| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 215 |
| 216 // Simulates a Descriptor on a service. | 216 // Simulates a Descriptor on a service. |
| 217 virtual void SimulateGattDescriptor( | 217 virtual void SimulateGattDescriptor( |
| 218 BluetoothRemoteGattCharacteristic* characteristic, | 218 BluetoothRemoteGattCharacteristic* characteristic, |
| 219 const std::string& uuid) {} | 219 const std::string& uuid) {} |
| 220 | 220 |
| 221 // Simulates reading a value from a locally hosted GATT characteristic by a | 221 // Simulates reading a value from a locally hosted GATT characteristic by a |
| 222 // remote central device. Returns the value that was read from the local | 222 // remote central device. Returns the value that was read from the local |
| 223 // GATT characteristic in the value callback. | 223 // GATT characteristic in the value callback. |
| 224 virtual void SimulateLocalGattCharacteristicValueReadRequest( | 224 virtual void SimulateLocalGattCharacteristicValueReadRequest( |
| 225 BluetoothLocalGattService* service, | |
| 226 BluetoothLocalGattCharacteristic* characteristic, | 225 BluetoothLocalGattCharacteristic* characteristic, |
| 227 const BluetoothLocalGattService::Delegate::ValueCallback& value_callback, | 226 const BluetoothLocalGattService::Delegate::ValueCallback& value_callback, |
| 228 const base::Closure& error_callback) {} | 227 const base::Closure& error_callback) {} |
| 229 | 228 |
| 230 // Simulates write a value to a locally hosted GATT characteristic by a | 229 // Simulates write a value to a locally hosted GATT characteristic by a |
| 231 // remote central device. | 230 // remote central device. |
| 232 virtual void SimulateLocalGattCharacteristicValueWriteRequest( | 231 virtual void SimulateLocalGattCharacteristicValueWriteRequest( |
| 233 BluetoothLocalGattService* service, | |
| 234 BluetoothLocalGattCharacteristic* characteristic, | 232 BluetoothLocalGattCharacteristic* characteristic, |
| 235 const std::vector<uint8_t>& value_to_write, | 233 const std::vector<uint8_t>& value_to_write, |
| 236 const base::Closure& success_callback, | 234 const base::Closure& success_callback, |
| 237 const base::Closure& error_callback) {} | 235 const base::Closure& error_callback) {} |
| 238 | 236 |
| 239 // Simulates reading a value from a locally hosted GATT descriptor by a | 237 // Simulates reading a value from a locally hosted GATT descriptor by a |
| 240 // remote central device. Returns the value that was read from the local | 238 // remote central device. Returns the value that was read from the local |
| 241 // GATT descriptor in the value callback. | 239 // GATT descriptor in the value callback. |
| 242 virtual void SimulateLocalGattDescriptorValueReadRequest( | 240 virtual void SimulateLocalGattDescriptorValueReadRequest( |
| 243 BluetoothLocalGattService* service, | |
| 244 BluetoothLocalGattDescriptor* descriptor, | 241 BluetoothLocalGattDescriptor* descriptor, |
| 245 const BluetoothLocalGattService::Delegate::ValueCallback& value_callback, | 242 const BluetoothLocalGattService::Delegate::ValueCallback& value_callback, |
| 246 const base::Closure& error_callback) {} | 243 const base::Closure& error_callback) {} |
| 247 | 244 |
| 248 // Simulates write a value to a locally hosted GATT descriptor by a | 245 // Simulates write a value to a locally hosted GATT descriptor by a |
| 249 // remote central device. | 246 // remote central device. |
| 250 virtual void SimulateLocalGattDescriptorValueWriteRequest( | 247 virtual void SimulateLocalGattDescriptorValueWriteRequest( |
| 251 BluetoothLocalGattService* service, | |
| 252 BluetoothLocalGattDescriptor* descriptor, | 248 BluetoothLocalGattDescriptor* descriptor, |
| 253 const std::vector<uint8_t>& value_to_write, | 249 const std::vector<uint8_t>& value_to_write, |
| 254 const base::Closure& success_callback, | 250 const base::Closure& success_callback, |
| 255 const base::Closure& error_callback) {} | 251 const base::Closure& error_callback) {} |
| 256 | 252 |
| 257 // Simulates starting or stopping a notification session for a locally | 253 // Simulates starting or stopping a notification session for a locally |
| 258 // hosted GATT characteristic by a remote device. Returns false if we were | 254 // hosted GATT characteristic by a remote device. Returns false if we were |
| 259 // not able to start or stop notifications. | 255 // not able to start or stop notifications. |
| 260 virtual bool SimulateLocalGattCharacteristicNotificationsRequest( | 256 virtual bool SimulateLocalGattCharacteristicNotificationsRequest( |
| 261 BluetoothLocalGattService* service, | |
| 262 BluetoothLocalGattCharacteristic* characteristic, | 257 BluetoothLocalGattCharacteristic* characteristic, |
| 263 bool start); | 258 bool start); |
| 264 | 259 |
| 265 // Returns the value for the last notification that was sent on this | 260 // Returns the value for the last notification that was sent on this |
| 266 // characteristic. | 261 // characteristic. |
| 267 virtual std::vector<uint8_t> LastNotifactionValueForCharacteristic( | 262 virtual std::vector<uint8_t> LastNotifactionValueForCharacteristic( |
| 268 BluetoothLocalGattCharacteristic* characteristic); | 263 BluetoothLocalGattCharacteristic* characteristic); |
| 269 | 264 |
| 270 // Remembers |descriptor|'s platform specific object to be used in a | 265 // Remembers |descriptor|'s platform specific object to be used in a |
| 271 // subsequent call to methods such as SimulateGattDescriptorRead that | 266 // subsequent call to methods such as SimulateGattDescriptorRead that |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 int actual_error_callback_calls_ = 0; | 393 int actual_error_callback_calls_ = 0; |
| 399 bool unexpected_success_callback_ = false; | 394 bool unexpected_success_callback_ = false; |
| 400 bool unexpected_error_callback_ = false; | 395 bool unexpected_error_callback_ = false; |
| 401 | 396 |
| 402 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 397 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
| 403 }; | 398 }; |
| 404 | 399 |
| 405 } // namespace device | 400 } // namespace device |
| 406 | 401 |
| 407 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 402 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
| OLD | NEW |