| Index: device/bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java
|
| diff --git a/device/bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java b/device/bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java
|
| index 56c950edf773b663fcd3481b7299b1f29b9296ff..09da34b73c374d8bb8c71e197ddfd5455fd7651c 100644
|
| --- a/device/bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java
|
| +++ b/device/bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java
|
| @@ -454,6 +454,24 @@ class Fakes {
|
| mDescriptors = new ArrayList<Wrappers.BluetoothGattDescriptorWrapper>();
|
| }
|
|
|
| + // Simulate a characteristic value notified as changed.
|
| + @CalledByNative("FakeBluetoothGattCharacteristic")
|
| + private static void valueChanged(
|
| + ChromeBluetoothRemoteGattCharacteristic chromeCharacteristic, byte[] value) {
|
| + if (chromeCharacteristic == null && sRememberedCharacteristic == null) {
|
| + throw new IllegalArgumentException(
|
| + "rememberCharacteristic wasn't called previously.");
|
| + }
|
| +
|
| + FakeBluetoothGattCharacteristic fakeCharacteristic = (chromeCharacteristic == null)
|
| + ? sRememberedCharacteristic
|
| + : (FakeBluetoothGattCharacteristic) chromeCharacteristic.mCharacteristic;
|
| +
|
| + fakeCharacteristic.mValue = value;
|
| + fakeCharacteristic.mService.mDevice.mGattCallback.onCharacteristicChanged(
|
| + fakeCharacteristic);
|
| + }
|
| +
|
| // Implements BluetoothTestAndroid::RememberCharacteristicForSubsequentAction.
|
| @CalledByNative("FakeBluetoothGattCharacteristic")
|
| private static void rememberCharacteristicForSubsequentAction(
|
| @@ -553,6 +571,16 @@ class Fakes {
|
| // Wrappers.BluetoothGattCharacteristicWrapper overrides:
|
|
|
| @Override
|
| + public Wrappers.BluetoothGattDescriptorWrapper getDescriptor(UUID uuid) {
|
| + for (Wrappers.BluetoothGattDescriptorWrapper descriptor : mDescriptors) {
|
| + if (descriptor.getUuid().equals(uuid)) {
|
| + return descriptor;
|
| + }
|
| + }
|
| + return null;
|
| + }
|
| +
|
| + @Override
|
| public List<Wrappers.BluetoothGattDescriptorWrapper> getDescriptors() {
|
| return mDescriptors;
|
| }
|
|
|