Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1ec4628 authored by Ben Lawson's avatar Ben Lawson Committed by Gerrit Code Review
Browse files

Merge "BumbleBluetoothTests: Improve directConnectGattAfterClose" into main

parents 2cb3c3fa 67cc6df2
Loading
Loading
Loading
Loading
+17 −20
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ public class GattClientTest {
                mAdapter.getRemoteLeDevice(
                        Utils.BUMBLE_RANDOM_ADDRESS, BluetoothDevice.ADDRESS_TYPE_RANDOM);

        for (int i = 0; i < 10; i++) {
        BluetoothGattCallback gattCallback = mock(BluetoothGattCallback.class);
        BluetoothGatt gatt = device.connectGatt(mContext, false, gattCallback);
        gatt.close();
@@ -100,16 +99,14 @@ public class GattClientTest {
        BluetoothGatt gatt2 = device.connectGatt(mContext, false, gattCallback2);
        verify(gattCallback2, timeout(1000))
                .onConnectionStateChange(any(), anyInt(), eq(BluetoothProfile.STATE_CONNECTED));
            gatt2.close();
        disconnectAndWaitDisconnection(gatt2, gattCallback2);

            // After reconnecting with the second set of callback, check that nothing happened on
            // the first set of callback
        // After reconnecting, verify the first callback was not invoked.
        Collection<Invocation> invocationsAfterSomeTimes =
                mockingDetails(gattCallback).getInvocations();
        int numberOfCallsAfterSomeTimes = invocationsAfterSomeTimes.size();
        assertThat(numberOfCallsAfterSomeTimes).isEqualTo(numberOfCalls);
    }
    }

    @Test
    public void fullGattClientLifecycle() throws Exception {