| Index: device/bluetooth/test/bluetooth_test_android.cc
|
| diff --git a/device/bluetooth/test/bluetooth_test_android.cc b/device/bluetooth/test/bluetooth_test_android.cc
|
| index af56f013d43180ce56a062765ba4a6b20b9ece22..7c6e3f03cc4e1131c1f496f22418f7da1aa2019f 100644
|
| --- a/device/bluetooth/test/bluetooth_test_android.cc
|
| +++ b/device/bluetooth/test/bluetooth_test_android.cc
|
| @@ -174,21 +174,50 @@ void BluetoothTestAndroid::RememberCharacteristicForSubsequentAction(
|
| characteristic_android->GetJavaObject().obj());
|
| }
|
|
|
| -void BluetoothTestAndroid::SimulateGattNotifySessionStarted(
|
| +void BluetoothTestAndroid::RememberCCCDescriptorForSubsequentAction(
|
| BluetoothGattCharacteristic* characteristic) {
|
| - BluetoothGattDescriptor* descriptor =
|
| + remembered_ccc_descriptor_ =
|
| characteristic
|
| ->GetDescriptorsForUUID(
|
| BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid())
|
| .at(0);
|
| - BluetoothRemoteGattDescriptorAndroid* descriptor_android =
|
| - static_cast<BluetoothRemoteGattDescriptorAndroid*>(descriptor);
|
| + DCHECK(remembered_ccc_descriptor_);
|
| + RememberDescriptorForSubsequentAction(remembered_ccc_descriptor_);
|
| +}
|
| +
|
| +void BluetoothTestAndroid::SimulateGattNotifySessionStarted(
|
| + BluetoothGattCharacteristic* characteristic) {
|
| + BluetoothRemoteGattDescriptorAndroid* descriptor_android = nullptr;
|
| + if (characteristic) {
|
| + descriptor_android = static_cast<BluetoothRemoteGattDescriptorAndroid*>(
|
| + characteristic
|
| + ->GetDescriptorsForUUID(BluetoothGattDescriptor::
|
| + ClientCharacteristicConfigurationUuid())
|
| + .at(0));
|
| + }
|
| Java_FakeBluetoothGattDescriptor_valueWrite(
|
| base::android::AttachCurrentThread(),
|
| descriptor_android ? descriptor_android->GetJavaObject().obj() : nullptr,
|
| 0); // android.bluetooth.BluetoothGatt.GATT_SUCCESS
|
| }
|
|
|
| +void BluetoothTestAndroid::SimulateGattNotifySessionStartError(
|
| + BluetoothGattCharacteristic* characteristic,
|
| + BluetoothGattService::GattErrorCode error_code) {
|
| + BluetoothRemoteGattDescriptorAndroid* descriptor_android = nullptr;
|
| + if (characteristic) {
|
| + descriptor_android = static_cast<BluetoothRemoteGattDescriptorAndroid*>(
|
| + characteristic
|
| + ->GetDescriptorsForUUID(BluetoothGattDescriptor::
|
| + ClientCharacteristicConfigurationUuid())
|
| + .at(0));
|
| + }
|
| + Java_FakeBluetoothGattDescriptor_valueWrite(
|
| + base::android::AttachCurrentThread(),
|
| + descriptor_android ? descriptor_android->GetJavaObject().obj() : nullptr,
|
| + BluetoothRemoteGattServiceAndroid::GetAndroidErrorCode(error_code));
|
| +}
|
| +
|
| void BluetoothTestAndroid::
|
| SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce(
|
| BluetoothGattCharacteristic* characteristic) {
|
|
|