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

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

Issue 2051333004: Implement BluetoothGattNotifySession::Stop on Android, 2nd attempt (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Giovanni's review comments Created 4 years, 5 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
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 2756f2421029ed6db70c7017541e5c03435d1981..f9565d17d05ff7041807d2fa31b0373e60d540a8 100644
--- a/device/bluetooth/test/bluetooth_test_android.cc
+++ b/device/bluetooth/test/bluetooth_test_android.cc
@@ -227,6 +227,39 @@ void BluetoothTestAndroid::SimulateGattNotifySessionStartError(
BluetoothRemoteGattServiceAndroid::GetAndroidErrorCode(error_code));
}
+void BluetoothTestAndroid::SimulateGattNotifySessionStopped(
+ BluetoothRemoteGattCharacteristic* characteristic) {
+ BluetoothRemoteGattDescriptorAndroid* descriptor_android = nullptr;
+ if (characteristic) {
+ descriptor_android = static_cast<BluetoothRemoteGattDescriptorAndroid*>(
+ characteristic
+ ->GetDescriptorsByUUID(BluetoothRemoteGattDescriptor::
+ ClientCharacteristicConfigurationUuid())
+ .at(0));
+ }
+ Java_FakeBluetoothGattDescriptor_valueWrite(
+ base::android::AttachCurrentThread(),
+ descriptor_android ? descriptor_android->GetJavaObject().obj() : nullptr,
+ 0); // android.bluetooth.BluetoothGatt.GATT_SUCCESS
+}
+
+void BluetoothTestAndroid::SimulateGattNotifySessionStopError(
+ BluetoothRemoteGattCharacteristic* characteristic,
+ BluetoothRemoteGattService::GattErrorCode error_code) {
+ BluetoothRemoteGattDescriptorAndroid* descriptor_android = nullptr;
+ if (characteristic) {
+ descriptor_android = static_cast<BluetoothRemoteGattDescriptorAndroid*>(
+ characteristic
+ ->GetDescriptorsByUUID(BluetoothRemoteGattDescriptor::
+ ClientCharacteristicConfigurationUuid())
+ .at(0));
+ }
+ Java_FakeBluetoothGattDescriptor_valueWrite(
+ base::android::AttachCurrentThread(),
+ descriptor_android ? descriptor_android->GetJavaObject().obj() : nullptr,
+ BluetoothRemoteGattServiceAndroid::GetAndroidErrorCode(error_code));
+}
+
void BluetoothTestAndroid::
SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce(
BluetoothRemoteGattCharacteristic* characteristic) {

Powered by Google App Engine
This is Rietveld 408576698