Merge "Fix crash in Monkey test." into pi-dev

This commit is contained in:
TreeHugger Robot
2018-04-05 17:46:21 +00:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 1 deletions

View File

@@ -149,6 +149,19 @@ public class BatteryTipPreferenceControllerTest {
assertOnlyContainsSummaryTip(mPreferenceGroup);
}
@Test
public void testRestoreFromNull_shouldNotCrash() {
final Bundle bundle = new Bundle();
// Battery tip list is null at this time
mBatteryTipPreferenceController.saveInstanceState(bundle);
final BatteryTipPreferenceController controller = new BatteryTipPreferenceController(
mContext, KEY_PREF, mSettingsActivity, mFragment, mBatteryTipListener);
// Should not crash
controller.restoreInstanceState(bundle);
}
@Test
public void testHandlePreferenceTreeClick_noDialog_invokeCallback() {
when(mBatteryTip.getType()).thenReturn(SMART_BATTERY_MANAGER);