summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Christine Hallstrom <hallstrom@google.com> 2025-03-07 13:05:44 -0800
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2025-03-07 13:05:44 -0800
commitbd5c58137e348a7f0e6c60e4798a1069f9188ade (patch)
tree5f71a0021cb1cd55708666d935d77c3e12078352
parent251a56a4ab5082929b9c2b45fa443344bac36fd8 (diff)
parentdf9d724f1005559742397e4b0103add15a0b9a92 (diff)
Merge "Bumble BT test for multiple GATT clients" into main am: d5888d471c am: df9d724f10
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2779438 Change-Id: I3a4fb3dd68c1111e34250108f4ad23a2c1d5486b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--framework/tests/bumble/src/android/bluetooth/GattClientTest.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/framework/tests/bumble/src/android/bluetooth/GattClientTest.java b/framework/tests/bumble/src/android/bluetooth/GattClientTest.java
index fa52d8c607..9b631dce91 100644
--- a/framework/tests/bumble/src/android/bluetooth/GattClientTest.java
+++ b/framework/tests/bumble/src/android/bluetooth/GattClientTest.java
@@ -510,6 +510,51 @@ public class GattClientTest {
assertThat(resp.getStatus()).isEqualTo(AttStatusCode.SUCCESS);
}
+ @Test
+ public void multipleGattClientsSeparateInteractions() throws Exception {
+ advertiseWithBumble();
+
+ BluetoothDevice device =
+ mAdapter.getRemoteLeDevice(
+ Utils.BUMBLE_RANDOM_ADDRESS, BluetoothDevice.ADDRESS_TYPE_RANDOM);
+
+ BluetoothGattCallback gattCallbackA = mock(BluetoothGattCallback.class);
+ BluetoothGattCallback gattCallbackB = mock(BluetoothGattCallback.class);
+ InOrder inOrder = inOrder(gattCallbackA, gattCallbackB);
+
+ BluetoothGatt gattA = device.connectGatt(mContext, false, gattCallbackA);
+ inOrder.verify(gattCallbackA, timeout(1000))
+ .onConnectionStateChange(any(), anyInt(), eq(BluetoothProfile.STATE_CONNECTED));
+
+ BluetoothGatt gattB = device.connectGatt(mContext, false, gattCallbackB);
+ inOrder.verify(gattCallbackB, timeout(1000))
+ .onConnectionStateChange(any(), anyInt(), eq(BluetoothProfile.STATE_CONNECTED));
+
+ gattA.disconnect();
+ inOrder.verify(gattCallbackA, timeout(1000))
+ .onConnectionStateChange(any(), anyInt(), eq(BluetoothProfile.STATE_DISCONNECTED));
+
+ gattA.connect();
+ inOrder.verify(gattCallbackA, timeout(1000))
+ .onConnectionStateChange(any(), anyInt(), eq(BluetoothProfile.STATE_CONNECTED));
+
+ gattB.disconnect();
+ inOrder.verify(gattCallbackB, timeout(1000))
+ .onConnectionStateChange(any(), anyInt(), eq(BluetoothProfile.STATE_DISCONNECTED));
+
+ gattB.close();
+
+ gattA.disconnect();
+ inOrder.verify(gattCallbackA, timeout(1000))
+ .onConnectionStateChange(any(), anyInt(), eq(BluetoothProfile.STATE_DISCONNECTED));
+
+ gattA.connect();
+ inOrder.verify(gattCallbackA, timeout(1000))
+ .onConnectionStateChange(any(), anyInt(), eq(BluetoothProfile.STATE_CONNECTED));
+
+ gattA.close();
+ }
+
private void advertiseWithBumble() {
AdvertiseRequest request =
AdvertiseRequest.newBuilder()