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

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

Issue 1395783005: bluetooth: android: BluetoothRemoteGattServiceAndroid::GetUUID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed jyasskin comments Created 5 years, 2 months 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') | device/device_tests.gyp » ('j') | 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 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(
« no previous file with comments | « device/bluetooth/test/bluetooth_test_android.h ('k') | device/device_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698