Support incompatible charger state in the battery main page
https://screenshot.googleplex.com/PrSzAtMAhsyqbsR Bug: 271775549 Test: make test RunSettingsRoboTests Change-Id: I0bb912eaab9c8837eaa3a9b998b3ebb5a8e6f99f
This commit is contained in:
@@ -36,6 +36,7 @@ import androidx.preference.Preference;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.testutils.BatteryTestUtils;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
@@ -136,7 +137,7 @@ public class TopLevelBatteryPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void getDashboardLabel_incompatibleCharger_returnsCorrectLabel() {
|
||||
setupIncompatibleEvent();
|
||||
BatteryTestUtils.setupIncompatibleEvent(mUsbPort, mUsbManager, mUsbPortStatus);
|
||||
mController.mPreference = new Preference(mContext);
|
||||
BatteryInfo info = new BatteryInfo();
|
||||
|
||||
@@ -150,14 +151,4 @@ public class TopLevelBatteryPreferenceControllerTest {
|
||||
assertThat(mController.getSummary())
|
||||
.isEqualTo(mContext.getString(R.string.battery_missing_message));
|
||||
}
|
||||
|
||||
private void setupIncompatibleEvent() {
|
||||
final List<UsbPort> usbPorts = new ArrayList<>();
|
||||
usbPorts.add(mUsbPort);
|
||||
when(mUsbManager.getPorts()).thenReturn(usbPorts);
|
||||
when(mUsbPort.getStatus()).thenReturn(mUsbPortStatus);
|
||||
when(mUsbPort.supportsComplianceWarnings()).thenReturn(true);
|
||||
when(mUsbPortStatus.isConnected()).thenReturn(true);
|
||||
when(mUsbPortStatus.getComplianceWarnings()).thenReturn(new int[]{1});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user