Chromium Code Reviews| 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..5f60a3701d96998f5832dddc43ae98c3e3f0697f 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,23 @@ 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) |
|
Jeffrey Yasskin
2016/01/14 00:13:43
Put braces around the 2-line block.
scheib
2016/01/14 01:12:27
Done.
|
| + 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 +570,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; |
| } |