| 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 BluetoothDevice* from_device, |
| 225 BluetoothLocalGattCharacteristic* characteristic, | 226 BluetoothLocalGattCharacteristic* characteristic, |
| 226 const BluetoothLocalGattService::Delegate::ValueCallback& value_callback, | 227 const BluetoothLocalGattService::Delegate::ValueCallback& value_callback, |
| 227 const base::Closure& error_callback) {} | 228 const base::Closure& error_callback) {} |
| 228 | 229 |
| 229 // Simulates write a value to a locally hosted GATT characteristic by a | 230 // Simulates write a value to a locally hosted GATT characteristic by a |
| 230 // remote central device. | 231 // remote central device. |
| 231 virtual void SimulateLocalGattCharacteristicValueWriteRequest( | 232 virtual void SimulateLocalGattCharacteristicValueWriteRequest( |
| 233 BluetoothDevice* from_device, |
| 232 BluetoothLocalGattCharacteristic* characteristic, | 234 BluetoothLocalGattCharacteristic* characteristic, |
| 233 const std::vector<uint8_t>& value_to_write, | 235 const std::vector<uint8_t>& value_to_write, |
| 234 const base::Closure& success_callback, | 236 const base::Closure& success_callback, |
| 235 const base::Closure& error_callback) {} | 237 const base::Closure& error_callback) {} |
| 236 | 238 |
| 237 // Simulates reading a value from a locally hosted GATT descriptor by a | 239 // Simulates reading a value from a locally hosted GATT descriptor by a |
| 238 // remote central device. Returns the value that was read from the local | 240 // remote central device. Returns the value that was read from the local |
| 239 // GATT descriptor in the value callback. | 241 // GATT descriptor in the value callback. |
| 240 virtual void SimulateLocalGattDescriptorValueReadRequest( | 242 virtual void SimulateLocalGattDescriptorValueReadRequest( |
| 243 BluetoothDevice* from_device, |
| 241 BluetoothLocalGattDescriptor* descriptor, | 244 BluetoothLocalGattDescriptor* descriptor, |
| 242 const BluetoothLocalGattService::Delegate::ValueCallback& value_callback, | 245 const BluetoothLocalGattService::Delegate::ValueCallback& value_callback, |
| 243 const base::Closure& error_callback) {} | 246 const base::Closure& error_callback) {} |
| 244 | 247 |
| 245 // 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 |
| 246 // remote central device. | 249 // remote central device. |
| 247 virtual void SimulateLocalGattDescriptorValueWriteRequest( | 250 virtual void SimulateLocalGattDescriptorValueWriteRequest( |
| 251 BluetoothDevice* from_device, |
| 248 BluetoothLocalGattDescriptor* descriptor, | 252 BluetoothLocalGattDescriptor* descriptor, |
| 249 const std::vector<uint8_t>& value_to_write, | 253 const std::vector<uint8_t>& value_to_write, |
| 250 const base::Closure& success_callback, | 254 const base::Closure& success_callback, |
| 251 const base::Closure& error_callback) {} | 255 const base::Closure& error_callback) {} |
| 252 | 256 |
| 253 // Simulates starting or stopping a notification session for a locally | 257 // Simulates starting or stopping a notification session for a locally |
| 254 // hosted GATT characteristic by a remote device. Returns false if we were | 258 // hosted GATT characteristic by a remote device. Returns false if we were |
| 255 // not able to start or stop notifications. | 259 // not able to start or stop notifications. |
| 256 virtual bool SimulateLocalGattCharacteristicNotificationsRequest( | 260 virtual bool SimulateLocalGattCharacteristicNotificationsRequest( |
| 257 BluetoothLocalGattCharacteristic* characteristic, | 261 BluetoothLocalGattCharacteristic* characteristic, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 int actual_error_callback_calls_ = 0; | 397 int actual_error_callback_calls_ = 0; |
| 394 bool unexpected_success_callback_ = false; | 398 bool unexpected_success_callback_ = false; |
| 395 bool unexpected_error_callback_ = false; | 399 bool unexpected_error_callback_ = false; |
| 396 | 400 |
| 397 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 401 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
| 398 }; | 402 }; |
| 399 | 403 |
| 400 } // namespace device | 404 } // namespace device |
| 401 | 405 |
| 402 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 406 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
| OLD | NEW |