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

Commit e1b17234 authored by Jakub Tyszkowski's avatar Jakub Tyszkowski Committed by Łukasz Rymanowski
Browse files

LeAudioServiceTest: Respect profile support flags

Fixes failed test runs for the disabled service.

Bug: 150670922
Tag: #feature
Test: atest BluetoothInstrumentationTests
Sponsor: jpawlowski@
Change-Id: Iea01a4c22f88ac5ed17b1e4fdc8117f9e66f96ff
parent 1732367e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -47,11 +47,13 @@ import androidx.test.filters.MediumTest;
import androidx.test.rule.ServiceTestRule;
import androidx.test.runner.AndroidJUnit4;

import com.android.bluetooth.R;
import com.android.bluetooth.TestUtils;
import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.btservice.storage.DatabaseManager;

import org.junit.After;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -98,6 +100,9 @@ public class LeAudioServiceTest {
    @Before
    public void setUp() throws Exception {
        mTargetContext = InstrumentationRegistry.getTargetContext();
        Assume.assumeTrue("Ignore test when LeAudioService is not enabled",
        mTargetContext.getResources().getBoolean(R.bool.profile_supported_le_audio));

        // Set up mocks and test assets
        MockitoAnnotations.initMocks(this);

@@ -149,6 +154,10 @@ public class LeAudioServiceTest {

    @After
    public void tearDown() throws Exception {
        if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_le_audio)) {
            return;
        }

        mBondedDevices.clear();
        mGroupIntentQueue.clear();
        stopService();