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

Commit 8877998d authored by William Escande's avatar William Escande
Browse files

Fix profile disable flakiness

The following
```
verify(adapterService).onProfileServiceStateChanged(profile)
assertThat(profile).isNull();
```
can fail because the profile is set to null after the call to
onProfileServiceStateChanged

By adding a verify on `removeProfile` I ensure the `profile.stop()` has
been called

Bug: 257183155
Test: atest BluetoothInstrumentationTests
Change-Id: I5b80b0f08435c911a41e63e9a40516ba8469c9eb
parent 1d1e5b5c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -186,6 +186,9 @@ public class TestUtils {
        verify(adapterService, timeout(SERVICE_TOGGLE_TIMEOUT_MS)).onProfileServiceStateChanged(
                profile.capture(), eq(BluetoothAdapter.STATE_OFF));
        Assert.assertEquals(profileServiceClass.getName(), profile.getValue().getClass().getName());
        ArgumentCaptor<ProfileService> profile2 = ArgumentCaptor.forClass(profileServiceClass);
        verify(adapterService, timeout(SERVICE_TOGGLE_TIMEOUT_MS)).removeProfile(profile2.capture());
        Assert.assertEquals(profileServiceClass.getName(), profile2.getValue().getClass().getName());
    }

    /**