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

Commit 373d9ef3 authored by Hyundo Moon's avatar Hyundo Moon
Browse files

Fix flaky MapClienTest#testConnect

Bug: 286781742
Test: atest com.android.bluetooth.mapclient.MapClientTest#testConnect \
        --rerun-until-failure 30
Change-Id: I96c6a557cc679709319d6a30061235785662a1d9
parent d64126cb
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -119,10 +119,11 @@ public class MapClientTest {
        Map<BluetoothDevice, MceStateMachine> map = mService.getInstanceMap();

        Assert.assertEquals(1, map.size());
        Assert.assertNotNull(map.get(device));
        TestUtils.waitForLooperToFinishScheduledTask(mService.getMainLooper());
        MceStateMachine sm = map.get(device);
        Assert.assertNotNull(sm);
        TestUtils.waitForLooperToFinishScheduledTask(sm.getHandler().getLooper());

        Assert.assertEquals(map.get(device).getState(), BluetoothProfile.STATE_CONNECTING);
        Assert.assertEquals(BluetoothProfile.STATE_CONNECTING, sm.getState());
        mService.cleanupDevice(device);
        Assert.assertNull(mService.getInstanceMap().get(device));
    }