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

Unified Diff: device/bluetooth/test/bluetooth_test_android.cc

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
« no previous file with comments | « device/bluetooth/test/bluetooth_test_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5cd0674ce44422be047e9cddb2e2271d193852f5..28514f7c9b06aecc1d9a90fb691253f4690370b4 100644
--- a/device/bluetooth/test/bluetooth_test_android.cc
+++ b/device/bluetooth/test/bluetooth_test_android.cc
@@ -10,6 +10,7 @@
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
#include "base/logging.h"
+#include "base/run_loop.h"
#include "device/bluetooth/android/wrappers.h"
#include "device/bluetooth/bluetooth_adapter_android.h"
#include "device/bluetooth/bluetooth_device_android.h"
@@ -156,6 +157,25 @@ void BluetoothTestAndroid::SimulateGattCharacteristic(
base::android::ConvertUTF8ToJavaString(env, uuid).obj(), properties);
}
+void BluetoothTestAndroid::SimulateGattNotifySessionStarted(
+ BluetoothGattCharacteristic* characteristic) {
+ // Android doesn't provide any sort of callback for when notifications have
+ // been enabled. So, just run the message loop to process the success
+ // callback.
+ base::RunLoop().RunUntilIdle();
+}
+
+void BluetoothTestAndroid::
+ SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce(
+ BluetoothGattCharacteristic* characteristic) {
+ BluetoothRemoteGattCharacteristicAndroid* characteristic_android =
+ static_cast<BluetoothRemoteGattCharacteristicAndroid*>(characteristic);
+ JNIEnv* env = base::android::AttachCurrentThread();
+
+ Java_FakeBluetoothGattCharacteristic_setCharacteristicNotificationWillFailSynchronouslyOnce(
+ env, characteristic_android->GetJavaObject().obj());
+}
+
void BluetoothTestAndroid::SimulateGattCharacteristicRead(
BluetoothGattCharacteristic* characteristic,
const std::vector<uint8>& value) {
@@ -241,6 +261,12 @@ void BluetoothTestAndroid::OnFakeBluetoothGattDiscoverServices(JNIEnv* env,
gatt_discovery_attempts_++;
}
+void BluetoothTestAndroid::OnFakeBluetoothGattSetCharacteristicNotification(
+ JNIEnv* env,
+ jobject caller) {
+ gatt_notify_characteristic_attempts_++;
+}
+
void BluetoothTestAndroid::OnFakeBluetoothGattReadCharacteristic(
JNIEnv* env,
jobject caller) {
« no previous file with comments | « device/bluetooth/test/bluetooth_test_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698