diff options
2 files changed, 12 insertions, 2 deletions
diff --git a/packages/SettingsLib/tests/robotests/src/android/bluetooth/BluetoothCodecConfig.java b/packages/SettingsLib/tests/robotests/src/android/bluetooth/BluetoothCodecConfig.java index 656ab86e6987..14b0d5986817 100644 --- a/packages/SettingsLib/tests/robotests/src/android/bluetooth/BluetoothCodecConfig.java +++ b/packages/SettingsLib/tests/robotests/src/android/bluetooth/BluetoothCodecConfig.java @@ -21,5 +21,6 @@ package android.bluetooth; */ public class BluetoothCodecConfig { public boolean isMandatoryCodec() { return true; } - public String getCodecName() { return null;} + public String getCodecName() { return null; } + public int getCodecType() { return -1; } } diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/A2dpProfileTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/A2dpProfileTest.java index 07a0e11dc063..4a73c1bb61aa 100644 --- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/A2dpProfileTest.java +++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/A2dpProfileTest.java @@ -21,6 +21,7 @@ import android.bluetooth.BluetoothCodecStatus; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.Context; +import android.content.res.Resources; import com.android.settingslib.R; import com.android.settingslib.TestConfig; @@ -133,6 +134,8 @@ public class A2dpProfileTest { // Strings to use in fake resource lookups. private static String KNOWN_CODEC_LABEL = "Use high quality audio: %1$s"; private static String UNKNOWN_CODEC_LABEL = "Use high quality audio"; + private static String[] CODEC_NAMES = + new String[] { "Default", "SBC", "AAC", "aptX", "aptX HD", "LDAC" }; /** * Helper for setting up several tests of getHighQualityAudioOptionLabel @@ -147,6 +150,11 @@ public class A2dpProfileTest { when(mContext.getString(eq(R.string.bluetooth_profile_a2dp_high_quality_unknown_codec))) .thenReturn(UNKNOWN_CODEC_LABEL); + final Resources res = mock(Resources.class); + when(mContext.getResources()).thenReturn(res); + when(res.getStringArray(eq(R.array.bluetooth_a2dp_codec_titles))) + .thenReturn(CODEC_NAMES); + // Most tests want to simulate optional codecs being supported by the device, so do that // by default here. when(mBluetoothA2dpWrapper.supportsOptionalCodecs(any())).thenReturn( @@ -196,7 +204,8 @@ public class A2dpProfileTest { when(status.getCodecsSelectableCapabilities()).thenReturn(configs); when(config.isMandatoryCodec()).thenReturn(false); - when(config.getCodecName()).thenReturn("PiedPiper"); + when(config.getCodecType()).thenReturn(4); + when(config.getCodecName()).thenReturn("LDAC"); assertThat(mProfile.getHighQualityAudioOptionLabel(mDevice)).isEqualTo( String.format(KNOWN_CODEC_LABEL, config.getCodecName())); } |