Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Unified Diff: device/bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java

Issue 1422463012: bluetooth: android: Implement StartNotifySession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed ortuno Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 a38f749acf2a34274c5a4533e8eebe9ca31d11bc..bf3d8a01a5bef369cbb1cb8915b7e4e19efd6286 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
@@ -277,6 +277,7 @@ class Fakes {
final FakeBluetoothDevice mDevice;
final ArrayList<Wrappers.BluetoothGattServiceWrapper> mServices;
boolean mReadCharacteristicWillFailSynchronouslyOnce = false;
+ boolean mSetCharacteristicNotificationWillFailSynchronouslyOnce = false;
boolean mWriteCharacteristicWillFailSynchronouslyOnce = false;
public FakeBluetoothGatt(FakeBluetoothDevice device) {
@@ -312,6 +313,18 @@ class Fakes {
}
@Override
+ boolean setCharacteristicNotification(
+ Wrappers.BluetoothGattCharacteristicWrapper characteristic, boolean enable) {
+ if (mSetCharacteristicNotificationWillFailSynchronouslyOnce) {
+ mSetCharacteristicNotificationWillFailSynchronouslyOnce = false;
+ return false;
+ }
+ nativeOnFakeBluetoothGattSetCharacteristicNotification(
+ mDevice.mAdapter.mNativeBluetoothTestAndroid);
+ return true;
+ }
+
+ @Override
boolean writeCharacteristic(Wrappers.BluetoothGattCharacteristicWrapper characteristic) {
if (mWriteCharacteristicWillFailSynchronouslyOnce) {
mWriteCharacteristicWillFailSynchronouslyOnce = false;
@@ -424,6 +437,17 @@ class Fakes {
// Cause subsequent value reads of a characteristic to fail synchronously.
@CalledByNative("FakeBluetoothGattCharacteristic")
+ private static void setCharacteristicNotificationWillFailSynchronouslyOnce(
+ ChromeBluetoothRemoteGattCharacteristic chromeCharacteristic) {
+ FakeBluetoothGattCharacteristic fakeCharacteristic =
+ (FakeBluetoothGattCharacteristic) chromeCharacteristic.mCharacteristic;
+
+ fakeCharacteristic.mService.mDevice.mGatt
+ .mSetCharacteristicNotificationWillFailSynchronouslyOnce = true;
+ }
+
+ // Cause subsequent value reads of a characteristic to fail synchronously.
+ @CalledByNative("FakeBluetoothGattCharacteristic")
private static void setReadCharacteristicWillFailSynchronouslyOnce(
ChromeBluetoothRemoteGattCharacteristic chromeCharacteristic) {
FakeBluetoothGattCharacteristic fakeCharacteristic =
@@ -477,22 +501,26 @@ class Fakes {
// ---------------------------------------------------------------------------------------------
// BluetoothTestAndroid C++ methods declared for access from java:
- // Binds to BluetoothAdapterAndroid::OnFakeBluetoothDeviceConnectGattCalled.
+ // Binds to BluetoothTestAndroid::OnFakeBluetoothDeviceConnectGattCalled.
private static native void nativeOnFakeBluetoothDeviceConnectGattCalled(
long nativeBluetoothTestAndroid);
- // Binds to BluetoothAdapterAndroid::OnFakeBluetoothGattDisconnect.
+ // Binds to BluetoothTestAndroid::OnFakeBluetoothGattDisconnect.
private static native void nativeOnFakeBluetoothGattDisconnect(long nativeBluetoothTestAndroid);
- // Binds to BluetoothAdapterAndroid::OnFakeBluetoothGattDiscoverServices.
+ // Binds to BluetoothTestAndroid::OnFakeBluetoothGattDiscoverServices.
private static native void nativeOnFakeBluetoothGattDiscoverServices(
long nativeBluetoothTestAndroid);
- // Binds to BluetoothAdapterAndroid::OnFakeBluetoothGattReadCharacteristic.
+ // Binds to BluetoothTestAndroid::OnFakeBluetoothGattSetCharacteristicNotification.
+ private static native void nativeOnFakeBluetoothGattSetCharacteristicNotification(
+ long nativeBluetoothTestAndroid);
+
+ // Binds to BluetoothTestAndroid::OnFakeBluetoothGattReadCharacteristic.
private static native void nativeOnFakeBluetoothGattReadCharacteristic(
long nativeBluetoothTestAndroid);
- // Binds to BluetoothAdapterAndroid::OnFakeBluetoothGattWriteCharacteristic.
+ // Binds to BluetoothTestAndroid::OnFakeBluetoothGattWriteCharacteristic.
private static native void nativeOnFakeBluetoothGattWriteCharacteristic(
long nativeBluetoothTestAndroid, byte[] value);
}
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc ('k') | device/bluetooth/test/bluetooth_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698