summaryrefslogtreecommitdiffstats
path: root/device/bluetooth/test/bluetooth_test.h
diff options
context:
space:
mode:
Diffstat (limited to 'device/bluetooth/test/bluetooth_test.h')
-rw-r--r--device/bluetooth/test/bluetooth_test.h36
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