Merge "Hide BatteryManagerPreference if there is no adaptive charging" into udc-dev
This commit is contained in:
@@ -61,12 +61,6 @@ public class TopLevelBatteryPreferenceControllerTest {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void getAvailabilityStatus_unsupportedWhenSet() {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertClassPathToComponentName_nullInput_returnsNull() {
|
||||
assertThat(mController.convertClassPathToComponentName(null)).isNull();
|
||||
@@ -118,4 +112,4 @@ public class TopLevelBatteryPreferenceControllerTest {
|
||||
assertThat(mController.getSummary())
|
||||
.isEqualTo(mContext.getString(R.string.battery_missing_message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -86,6 +86,7 @@ public class BatteryManagerPreferenceControllerTest {
|
||||
@Test
|
||||
public void getAvailabilityStatus_supportBatteryManager_showPrefPage() {
|
||||
when(mPowerUsageFeatureProvider.isBatteryManagerSupported()).thenReturn(true);
|
||||
when(mPowerUsageFeatureProvider.isAdaptiveChargingSupported()).thenReturn(true);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||
BatteryManagerPreferenceController.AVAILABLE_UNSEARCHABLE);
|
||||
@@ -98,4 +99,13 @@ public class BatteryManagerPreferenceControllerTest {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||
BatteryManagerPreferenceController.UNSUPPORTED_ON_DEVICE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_supportBatteryManagerWithoutAC_notShowPrefPage() {
|
||||
when(mPowerUsageFeatureProvider.isBatteryManagerSupported()).thenReturn(true);
|
||||
when(mPowerUsageFeatureProvider.isAdaptiveChargingSupported()).thenReturn(false);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||
BatteryManagerPreferenceController.UNSUPPORTED_ON_DEVICE);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user