Merge "Revert "Pass in active device to all BluetoothA2dp APIs in packa...""
This commit is contained in:
@@ -103,15 +103,13 @@ public class AbstractBluetoothDialogPreferenceControllerTest {
|
||||
@Test
|
||||
public void onIndexUpdated_checkFlow() {
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, null);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dpConfigStore.createCodecConfig()).thenReturn(mCodecConfigAAC);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
mController.onIndexUpdated(mCurrentConfig);
|
||||
|
||||
verify(mController).writeConfigurationValues(mCurrentConfig);
|
||||
verify(mBluetoothA2dp).setCodecConfigPreference(
|
||||
mBluetoothA2dp.getActiveDevice(), mCodecConfigAAC);
|
||||
verify(mBluetoothA2dp).setCodecConfigPreference(null, mCodecConfigAAC);
|
||||
assertThat(mPreference.getSummary()).isEqualTo(SUMMARY);
|
||||
}
|
||||
|
||||
@@ -136,15 +134,14 @@ public class AbstractBluetoothDialogPreferenceControllerTest {
|
||||
assertThat(mController.getCurrentCodecConfig()).isNull();
|
||||
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
when(mBluetoothA2dp.getCodecStatus(mBluetoothA2dp.getActiveDevice())).thenReturn(null);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(null);
|
||||
assertThat(mController.getCurrentCodecConfig()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCurrentCodecConfig_verifyConfig() {
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, null);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
|
||||
assertThat(mController.getCurrentCodecConfig()).isEqualTo(mCodecConfigAAC);
|
||||
@@ -153,8 +150,7 @@ public class AbstractBluetoothDialogPreferenceControllerTest {
|
||||
@Test
|
||||
public void getSelectableConfigs_verifyConfig() {
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
|
||||
assertThat(mController.getSelectableConfigs(null)).isEqualTo(mCodecConfigs);
|
||||
@@ -163,8 +159,7 @@ public class AbstractBluetoothDialogPreferenceControllerTest {
|
||||
@Test
|
||||
public void getSelectableByCodecType_verifyConfig() {
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
|
||||
assertThat(mController.getSelectableByCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC))
|
||||
@@ -174,8 +169,7 @@ public class AbstractBluetoothDialogPreferenceControllerTest {
|
||||
@Test
|
||||
public void getSelectableByCodecType_unavailable() {
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
|
||||
assertThat(mController.getSelectableByCodecType(
|
||||
@@ -185,8 +179,7 @@ public class AbstractBluetoothDialogPreferenceControllerTest {
|
||||
@Test
|
||||
public void onBluetoothServiceConnected_verifyBluetoothA2dpConfigStore() {
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
|
||||
verify(mBluetoothA2dpConfigStore).setCodecType(mCodecConfigAAC.getCodecType());
|
||||
|
@@ -92,8 +92,7 @@ public class BluetoothBitPerSampleDialogPreferenceControllerTest {
|
||||
public void writeConfigurationValues_selectDefault_setHighest() {
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
|
||||
mController.writeConfigurationValues(0);
|
||||
@@ -122,8 +121,7 @@ public class BluetoothBitPerSampleDialogPreferenceControllerTest {
|
||||
public void getSelectableIndex_verifyList() {
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
List<Integer> indexList = new ArrayList<>();
|
||||
indexList.add(mPreference.getDefaultIndex());
|
||||
|
@@ -92,8 +92,7 @@ public class BluetoothChannelModeDialogPreferenceControllerTest {
|
||||
public void writeConfigurationValues_selectDefault_setHighest() {
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigSBC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
|
||||
mController.writeConfigurationValues(0);
|
||||
@@ -119,8 +118,7 @@ public class BluetoothChannelModeDialogPreferenceControllerTest {
|
||||
public void getSelectableIndex_verifyList() {
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigSBC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
List<Integer> indexList = new ArrayList<>();
|
||||
indexList.add(mPreference.getDefaultIndex());
|
||||
|
@@ -99,8 +99,7 @@ public class BluetoothCodecDialogPreferenceControllerTest {
|
||||
public void writeConfigurationValues_selectDefault_setHighest() {
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigSBC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
|
||||
mController.writeConfigurationValues(0);
|
||||
@@ -112,8 +111,7 @@ public class BluetoothCodecDialogPreferenceControllerTest {
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC, mCodecConfigAPTX,
|
||||
mCodecConfigAPTXHD, mCodecConfigLDAC, mCodecConfigAAC, mCodecConfigSBC};
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigSBC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
|
||||
mController.writeConfigurationValues(1);
|
||||
@@ -140,8 +138,7 @@ public class BluetoothCodecDialogPreferenceControllerTest {
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC, mCodecConfigAPTX,
|
||||
mCodecConfigAPTXHD, mCodecConfigLDAC, mCodecConfigAAC, mCodecConfigSBC};
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
mController.writeConfigurationValues(2);
|
||||
|
||||
|
@@ -91,7 +91,7 @@ public class BluetoothHDAudioPreferenceControllerTest {
|
||||
@Test
|
||||
public void updateState_codecSupported_setEnable() {
|
||||
when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
|
||||
when(mBluetoothA2dp.isOptionalCodecsSupported(mActiveDevice)).thenReturn(
|
||||
when(mBluetoothA2dp.supportsOptionalCodecs(mActiveDevice)).thenReturn(
|
||||
mBluetoothA2dp.OPTIONAL_CODECS_SUPPORTED);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
mController.updateState(mPreference);
|
||||
@@ -102,7 +102,7 @@ public class BluetoothHDAudioPreferenceControllerTest {
|
||||
@Test
|
||||
public void updateState_codecNotSupported_setDisable() {
|
||||
when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
|
||||
when(mBluetoothA2dp.isOptionalCodecsSupported(mActiveDevice)).thenReturn(
|
||||
when(mBluetoothA2dp.supportsOptionalCodecs(mActiveDevice)).thenReturn(
|
||||
mBluetoothA2dp.OPTIONAL_CODECS_NOT_SUPPORTED);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
mController.updateState(mPreference);
|
||||
@@ -113,9 +113,9 @@ public class BluetoothHDAudioPreferenceControllerTest {
|
||||
@Test
|
||||
public void updateState_codecSupportedAndEnabled_checked() {
|
||||
when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
|
||||
when(mBluetoothA2dp.isOptionalCodecsSupported(mActiveDevice)).thenReturn(
|
||||
when(mBluetoothA2dp.supportsOptionalCodecs(mActiveDevice)).thenReturn(
|
||||
mBluetoothA2dp.OPTIONAL_CODECS_SUPPORTED);
|
||||
when(mBluetoothA2dp.isOptionalCodecsEnabled(mActiveDevice)).thenReturn(
|
||||
when(mBluetoothA2dp.getOptionalCodecsEnabled(mActiveDevice)).thenReturn(
|
||||
mBluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
mController.updateState(mPreference);
|
||||
@@ -126,9 +126,9 @@ public class BluetoothHDAudioPreferenceControllerTest {
|
||||
@Test
|
||||
public void updateState_codecSupportedAndDisabled_notChecked() {
|
||||
when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
|
||||
when(mBluetoothA2dp.isOptionalCodecsSupported(mActiveDevice)).thenReturn(
|
||||
when(mBluetoothA2dp.supportsOptionalCodecs(mActiveDevice)).thenReturn(
|
||||
mBluetoothA2dp.OPTIONAL_CODECS_SUPPORTED);
|
||||
when(mBluetoothA2dp.isOptionalCodecsEnabled(mActiveDevice)).thenReturn(
|
||||
when(mBluetoothA2dp.getOptionalCodecsEnabled(mActiveDevice)).thenReturn(
|
||||
mBluetoothA2dp.OPTIONAL_CODECS_PREF_DISABLED);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
mController.updateState(mPreference);
|
||||
|
@@ -110,8 +110,7 @@ public class BluetoothQualityDialogPreferenceControllerTest {
|
||||
public void updateState_codeTypeIsLDAC_enablePreference() {
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigLDAC};
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigLDAC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
mController.updateState(mPreference);
|
||||
|
||||
@@ -122,8 +121,7 @@ public class BluetoothQualityDialogPreferenceControllerTest {
|
||||
public void updateState_codeTypeAAC_disablePreference() {
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigLDAC};
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
mController.updateState(mPreference);
|
||||
|
||||
|
@@ -93,8 +93,7 @@ public class BluetoothSampleRateDialogPreferenceControllerTest {
|
||||
mCodecConfigSBC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC);
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
|
||||
mController.writeConfigurationValues(0);
|
||||
@@ -126,8 +125,7 @@ public class BluetoothSampleRateDialogPreferenceControllerTest {
|
||||
public void getSelectableIndex_verifyList() {
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
|
||||
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
|
||||
when(mBluetoothA2dp.getCodecStatus(
|
||||
mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
List<Integer> indexList = new ArrayList<>();
|
||||
indexList.add(mController.getDefaultIndex());
|
||||
|
Reference in New Issue
Block a user