| 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..48c2ab21437bed02e68d5fc569723755ba1d5366 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,
|
| + const std::vector<std::string>& uuids) {
|
| 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(
|
|
|