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

am: 85f6fd4a1f

Change-Id: Ib8c62963b09e938143fd9382622ea3843cd88be5
This commit is contained in:
Lei Yu
2018-04-05 11:40:23 -07:00
committed by android-build-merger
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);