summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Tyszkowski <jakub.tyszkowski@codecoup.pl>2021-11-07 09:32:03 +0100
committerƁukasz Rymanowski <lukasz.rymanowski@codecoup.pl>2021-11-12 22:37:44 +0000
commitc7e7caf826c9b76b408620b1bbda684a5be78917 (patch)
tree1a98b1ae68b488aaa79cd096b9976a3a9d3e0747
parent2ffb85620d98f4d19a7cbd8ca435c68b29e6c550 (diff)
downloadBluetooth-c7e7caf826c9b76b408620b1bbda684a5be78917.tar.gz
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
-rw-r--r--tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java b/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java
index 43ddfcc15..db66f001d 100644
--- a/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java
+++ b/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java
@@ -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();