Loading packages/SettingsLib/tests/robotests/src/android/bluetooth/BluetoothCodecConfig.java +2 −1 Original line number Diff line number Diff line Loading @@ -22,4 +22,5 @@ package android.bluetooth; public class BluetoothCodecConfig { public boolean isMandatoryCodec() { return true; } public String getCodecName() { return null; } public int getCodecType() { return -1; } } packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/A2dpProfileTest.java +10 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading @@ -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( Loading Loading @@ -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())); } Loading Loading
packages/SettingsLib/tests/robotests/src/android/bluetooth/BluetoothCodecConfig.java +2 −1 Original line number Diff line number Diff line Loading @@ -22,4 +22,5 @@ package android.bluetooth; public class BluetoothCodecConfig { public boolean isMandatoryCodec() { return true; } public String getCodecName() { return null; } public int getCodecType() { return -1; } }
packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/A2dpProfileTest.java +10 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading @@ -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( Loading Loading @@ -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())); } Loading