use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.
the class BluetoothQualityDialogPreferenceControllerTest method updateState_codeTypeIsLDAC_enablePreference.
@Test
public void updateState_codeTypeIsLDAC_enablePreference() {
BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigLDAC };
mCodecStatus = new BluetoothCodecStatus(mCodecConfigLDAC, null, mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.updateState(mPreference);
assertThat(mPreference.isEnabled()).isTrue();
}
use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.
the class BluetoothSampleRateDialogPreferenceControllerTest method writeConfigurationValues_selectDefault_setHighest.
@Test
public void writeConfigurationValues_selectDefault_setHighest() {
mCodecConfigSBC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC);
BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigSBC };
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.writeConfigurationValues(0);
verify(mBluetoothA2dpConfigStore).setSampleRate(BluetoothCodecConfig.SAMPLE_RATE_88200);
}
use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.
the class AbstractBluetoothDialogPreferenceControllerTest method getSelectableByCodecType_unavailable.
@Test
public void getSelectableByCodecType_unavailable() {
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
assertThat(mController.getSelectableByCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX)).isNull();
}
use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.
the class BluetoothCodecDialogPreferenceControllerTest method writeConfigurationValues_resetHighestConfig.
@Test
public void writeConfigurationValues_resetHighestConfig() {
BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigSBC, mCodecConfigAPTX, mCodecConfigAPTXHD, mCodecConfigLDAC, mCodecConfigAAC, mCodecConfigSBC };
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.writeConfigurationValues(2);
verify(mBluetoothA2dpConfigStore, atLeastOnce()).setCodecPriority(BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST);
verify(mBluetoothA2dpConfigStore, atLeastOnce()).setSampleRate(BluetoothCodecConfig.SAMPLE_RATE_88200);
verify(mBluetoothA2dpConfigStore, atLeastOnce()).setBitsPerSample(BluetoothCodecConfig.BITS_PER_SAMPLE_24);
verify(mBluetoothA2dpConfigStore, atLeastOnce()).setChannelMode(BluetoothCodecConfig.CHANNEL_MODE_STEREO);
}
use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.
the class AbstractBluetoothDialogPreferenceControllerTest method onIndexUpdated_checkFlow.
@Test
public void onIndexUpdated_checkFlow() {
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, null);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
when(mBluetoothA2dpConfigStore.createCodecConfig()).thenReturn(mCodecConfigAAC);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.onIndexUpdated(mCurrentConfig);
verify(mController).writeConfigurationValues(mCurrentConfig);
verify(mBluetoothA2dp).setCodecConfigPreference(mActiveDevice, mCodecConfigAAC);
assertThat(mPreference.getSummary()).isEqualTo(SUMMARY);
}
Aggregations