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

Commit c5196db5 authored by Fabian Kozynski's avatar Fabian Kozynski Committed by android-build-merger
Browse files

Merge "Fix flaky test" into qt-dev

am: 7de91bb8

Change-Id: I97d0290fd1ddf7fb39e92106bda27a45b3f948c0
parents 017badfe 7de91bb8
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -203,7 +203,8 @@ public class BluetoothControllerImplTest extends SysuiTestCase {
    }

    @Test
    public void testOnACLConnectionStateChange_updatesBluetoothStateOnConnection() {
    public void testOnACLConnectionStateChange_updatesBluetoothStateOnConnection()
            throws Exception {
        BluetoothController.Callback callback = mock(BluetoothController.Callback.class);
        mBluetoothControllerImpl.addCallback(callback);

@@ -215,6 +216,16 @@ public class BluetoothControllerImplTest extends SysuiTestCase {
        reset(callback);
        mBluetoothControllerImpl.onAclConnectionStateChanged(device,
                BluetoothProfile.STATE_CONNECTED);

        // Grab the main looper, we'll need it later.
        TestableLooper mainLooper = new TestableLooper(Looper.getMainLooper());

        try {
            mTestableLooper.processAllMessages();
            mainLooper.processAllMessages();
        } finally {
            mainLooper.destroy();
        }
        assertTrue(mBluetoothControllerImpl.isBluetoothConnected());
        verify(callback, atLeastOnce()).onBluetoothStateChange(anyBoolean());
    }