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

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

Issue 2499913002: bluetooth: android: Implement RetrieveGattConnectedDevicesWithFilter
Patch Set: rebase Created 4 years 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/bluetooth/test/bluetooth_test_mac.h » ('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 4b55498dda947984fbe682123bfdb9aba781d373..7e7e1cc158907afcdce32b7ce9627d478760f93f 100644
--- a/device/bluetooth/test/bluetooth_test_android.cc
+++ b/device/bluetooth/test/bluetooth_test_android.cc
@@ -56,19 +56,25 @@ bool BluetoothTestAndroid::PlatformSupportsLowEnergy() {
void BluetoothTestAndroid::InitWithDefaultAdapter() {
adapter_ = BluetoothAdapterAndroid::Create(
- BluetoothAdapterWrapper_CreateWithDefaultAdapter())
+ BluetoothAdapterWrapper_CreateWithDefaultAdapter(),
+ BluetoothManagerWrapper_CreateWithDefaultManager())
.get();
}
void BluetoothTestAndroid::InitWithoutDefaultAdapter() {
- adapter_ = BluetoothAdapterAndroid::Create(NULL).get();
+ adapter_ = BluetoothAdapterAndroid::Create(NULL, NULL).get();
}
void BluetoothTestAndroid::InitWithFakeAdapter() {
- j_fake_bluetooth_adapter_.Reset(Java_FakeBluetoothAdapter_create(
- AttachCurrentThread(), reinterpret_cast<intptr_t>(this)));
-
- adapter_ = BluetoothAdapterAndroid::Create(j_fake_bluetooth_adapter_).get();
+ JNIEnv* env = AttachCurrentThread();
+ j_fake_bluetooth_adapter_.Reset(
+ Java_FakeBluetoothAdapter_create(env, reinterpret_cast<intptr_t>(this)));
+ j_fake_bluetooth_manager_.Reset(
+ Java_FakeBluetoothManager_create(env, reinterpret_cast<intptr_t>(this)));
+
+ adapter_ = BluetoothAdapterAndroid::Create(j_fake_bluetooth_adapter_,
+ j_fake_bluetooth_manager_)
+ .get();
}
bool BluetoothTestAndroid::DenyPermission() {
@@ -85,6 +91,13 @@ BluetoothDevice* BluetoothTestAndroid::SimulateLowEnergyDevice(
return observer.last_device();
}
+void BluetoothTestAndroid::SimulateConnectedLowEnergyDevice(
+ ConnectedDeviceType device_type) {
+ Java_FakeBluetoothManager_simulateConnectedLowEnergyDevice(
+ AttachCurrentThread(), j_fake_bluetooth_manager_,
+ static_cast<int32_t>(device_type));
+}
+
void BluetoothTestAndroid::RememberDeviceForSubsequentAction(
BluetoothDevice* device) {
BluetoothDeviceAndroid* device_android =
@@ -518,6 +531,12 @@ void BluetoothTestAndroid::OnFakeBluetoothGattWriteDescriptor(
base::android::JavaByteArrayToByteVector(env, value, &last_write_value_);
}
+void BluetoothTestAndroid::OnFakeManagerGetConnectedDevices(
+ JNIEnv* env,
+ const JavaParamRef<jobject>& caller) {
+ manager_get_connected_devices_attempts_++;
+}
+
void BluetoothTestAndroid::OnFakeAdapterStateChanged(
JNIEnv* env,
const JavaParamRef<jobject>& caller,
« no previous file with comments | « device/bluetooth/test/bluetooth_test_android.h ('k') | device/bluetooth/test/bluetooth_test_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698