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

Commit 65cf92cf authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

VolumeControlService: Improve succeed connect test

If service got stopped when connect is ongoing, it seems
sent intent will not contain valid device, which will break a test:

java.lang.AssertionError
	at org.junit.Assert.fail(Assert.java:87)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.junit.Assert.assertNotNull(Assert.java:713)
	at org.junit.Assert.assertNotNull(Assert.java:723)
	at com.android.bluetooth.vc.VolumeControlServiceTest$VolumeControlIntentReceiver.onReceive(VolumeControlServiceTest.java:154)

For the testing purpose we want to keep null check in the
broadcastreceiver, therefore we change a test in the way that it ends
when CONNECTING state is propagated.

Bug: 209486207
Test: atest VolumeControlServiceTest
Change-Id: I5167aeca83e84fe5a78f29554e9d61d62a12426c
parent a7966cef
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -318,6 +318,10 @@ public class VolumeControlServiceTest {

        // Send a connect request
        Assert.assertTrue("Connect expected to succeed", mService.connect(mDevice));

        // Verify the connection state broadcast, and that we are in Connecting state
        verifyConnectionStateIntent(TIMEOUT_MS, mDevice, BluetoothProfile.STATE_CONNECTING,
                BluetoothProfile.STATE_DISCONNECTED);
    }

    /**