diff options
author | tommyt <tommyt@opera.com> | 2016-03-14 15:12:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-14 22:14:58 +0000 |
commit | 0348fa65c3d808f854f745fb9f8f185a5b74b922 (patch) | |
tree | a5dd2b2dc34bad55c18d974fb6d633ad13354493 /device/bluetooth/test/bluetooth_test.h | |
parent | 59d3539fc7ce60355ccf52c00733d33dde5e118a (diff) | |
download | chromium_src-0348fa65c3d808f854f745fb9f8f185a5b74b922.zip chromium_src-0348fa65c3d808f854f745fb9f8f185a5b74b922.tar.gz chromium_src-0348fa65c3d808f854f745fb9f8f185a5b74b922.tar.bz2 |
bluetooth: android: Confirm the notify session after the descriptor has been written.
This change also implements WriteRemoteDescriptor and
ReadRemoteDescriptor. Because of this, I've also added quite a few
descriptor unit tests. These tests are pretty much the same as the
read/write tests for characteristics.
BUG=584369
Review URL: https://codereview.chromium.org/1712593002
Cr-Commit-Position: refs/heads/master@{#381088}
Diffstat (limited to 'device/bluetooth/test/bluetooth_test.h')
-rw-r--r-- | device/bluetooth/test/bluetooth_test.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/device/bluetooth/test/bluetooth_test.h b/device/bluetooth/test/bluetooth_test.h index 5570ca1..c840935 100644 --- a/device/bluetooth/test/bluetooth_test.h +++ b/device/bluetooth/test/bluetooth_test.h @@ -189,6 +189,41 @@ class BluetoothTestBase : public testing::Test { BluetoothGattCharacteristic* characteristic, const std::string& uuid) {} + // Remembers |descriptor|'s platform specific object to be used in a + // subsequent call to methods such as SimulateGattDescriptorRead that + // accept a nullptr value to select this remembered descriptor. This + // enables tests where the platform attempts to reference descriptor + // objects after the Chrome objects have been deleted, e.g. with DeleteDevice. + virtual void RememberDescriptorForSubsequentAction( + BluetoothGattDescriptor* descriptor) {} + + // Simulates a Descriptor Read operation succeeding, returning |value|. + // If |descriptor| is null, acts upon the descriptor provided to + // RememberDescriptorForSubsequentAction. + virtual void SimulateGattDescriptorRead(BluetoothGattDescriptor* descriptor, + const std::vector<uint8_t>& value) {} + + // Simulates a Descriptor Read operation failing with a GattErrorCode. + virtual void SimulateGattDescriptorReadError( + BluetoothGattDescriptor* descriptor, + BluetoothGattService::GattErrorCode) {} + + // Simulates a Descriptor Read operation failing synchronously once for an + // unknown reason. + virtual void SimulateGattDescriptorReadWillFailSynchronouslyOnce( + BluetoothGattDescriptor* descriptor) {} + + // Simulates a Descriptor Write operation succeeding, returning |value|. + // If |descriptor| is null, acts upon the descriptor provided to + // RememberDescriptorForSubsequentAction. + virtual void SimulateGattDescriptorWrite( + BluetoothGattDescriptor* descriptor) {} + + // Simulates a Descriptor Write operation failing with a GattErrorCode. + virtual void SimulateGattDescriptorWriteError( + BluetoothGattDescriptor* descriptor, + BluetoothGattService::GattErrorCode) {} + // Simulates a Descriptor Write operation failing synchronously once for // an unknown reason. virtual void SimulateGattDescriptorWriteWillFailSynchronouslyOnce( @@ -250,6 +285,7 @@ class BluetoothTestBase : public testing::Test { int gatt_notify_characteristic_attempts_ = 0; int gatt_read_characteristic_attempts_ = 0; int gatt_write_characteristic_attempts_ = 0; + int gatt_read_descriptor_attempts_ = 0; int gatt_write_descriptor_attempts_ = 0; // The following values are used to make sure the correct callbacks |