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 01bc12ff2618c3000196f8536b838b741aa0ae54..718d0e6cb3e0fd746dff5d73bce9755e5211c475 100644 |
--- a/device/bluetooth/test/bluetooth_test_android.cc |
+++ b/device/bluetooth/test/bluetooth_test_android.cc |
@@ -4,6 +4,10 @@ |
#include "device/bluetooth/test/bluetooth_test_android.h" |
+#include <iterator> |
+#include <sstream> |
+ |
+#include "base/android/jni_string.h" |
#include "base/logging.h" |
#include "device/bluetooth/android/wrappers.h" |
#include "device/bluetooth/bluetooth_adapter_android.h" |
@@ -107,13 +111,22 @@ void BluetoothTestAndroid::SimulateGattDisconnection(BluetoothDevice* device) { |
} |
void BluetoothTestAndroid::SimulateGattServicesDiscovered( |
- BluetoothDevice* device) { |
+ BluetoothDevice* device, |
+ std::vector<std::string> uuids) { |
Jeffrey Yasskin
2015/10/15 23:48:30
Pass by const&.
scheib
2015/10/16 00:23:36
Done.
|
BluetoothDeviceAndroid* device_android = |
static_cast<BluetoothDeviceAndroid*>(device); |
+ JNIEnv* env = base::android::AttachCurrentThread(); |
+ |
+ // Join UUID strings into a single string. |
+ std::ostringstream uuids_space_delimited; |
+ std::copy(uuids.begin(), uuids.end(), |
+ std::ostream_iterator<std::string>(uuids_space_delimited, " ")); |
Java_FakeBluetoothDevice_servicesDiscovered( |
- AttachCurrentThread(), device_android->GetJavaObject().obj(), |
- 0); // android.bluetooth.BluetoothGatt.GATT_SUCCESS |
+ env, device_android->GetJavaObject().obj(), |
+ 0, // android.bluetooth.BluetoothGatt.GATT_SUCCESS |
+ base::android::ConvertUTF8ToJavaString(env, uuids_space_delimited.str()) |
+ .obj()); |
} |
void BluetoothTestAndroid::SimulateGattServicesDiscoveryError( |
@@ -123,7 +136,8 @@ void BluetoothTestAndroid::SimulateGattServicesDiscoveryError( |
Java_FakeBluetoothDevice_servicesDiscovered( |
AttachCurrentThread(), device_android->GetJavaObject().obj(), |
- 0x00000101); // android.bluetooth.BluetoothGatt.GATT_FAILURE |
+ 0x00000101, // android.bluetooth.BluetoothGatt.GATT_FAILURE |
+ nullptr); |
} |
void BluetoothTestAndroid::OnFakeBluetoothDeviceConnectGattCalled( |