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

Commit b4d86ee0 authored by Rongxuan Liu's avatar Rongxuan Liu
Browse files

le_audio: Fix broadcast test flakiness by waiting for scheduled callbacks

Test failure happened after we posted le audio callbacks on MainLoop

Tag: #bug
Flag: Exempt, test only
Bug: 336613768
Test: atest LeAudioServiceTest LeAudioBroadcastServiceTest
Change-Id: Icefc7788384adcfb7ca9d29b0c8ce3af84547f33
parent 1f1a6668
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -334,6 +334,8 @@ public class LeAudioBroadcastServiceTest {

        // Check if metadata is requested when the broadcast starts to stream
        verify(mLeAudioBroadcasterNativeInterface, times(1)).getBroadcastMetadata(eq(broadcastId));
        TestUtils.waitForLooperToFinishScheduledTask(mService.getMainLooper());

        Assert.assertFalse(mOnBroadcastStartFailedCalled);
        Assert.assertTrue(mOnBroadcastStartedCalled);
    }
@@ -476,6 +478,8 @@ public class LeAudioBroadcastServiceTest {

        // Verify if broadcast is auto-started on start
        verify(mLeAudioBroadcasterNativeInterface, times(1)).startBroadcast(eq(broadcastId));
        TestUtils.waitForLooperToFinishScheduledTask(mService.getMainLooper());

        Assert.assertTrue(mOnBroadcastStartedCalled);

        // Notify initial paused state