Merge "Expand ASM activation warning." into oc-dr1-dev

This commit is contained in:
Daniel Nishi
2017-07-11 19:46:19 +00:00
committed by Android (Google) Code Review
2 changed files with 30 additions and 3 deletions

View File

@@ -168,4 +168,23 @@ public class AutomaticStorageManagementSwitchPreferenceControllerTest {
verify(transaction, never()).add(any(), eq(ActivationWarningFragment.TAG));
}
@Config(shadows = {SettingsShadowSystemProperties.class})
@Test
public void togglingOnShouldTriggerWarningFragmentIfEnabledByDefaultAndDisabledByPolicy() {
FragmentTransaction transaction = mock(FragmentTransaction.class);
when(mFragmentManager.beginTransaction()).thenReturn(transaction);
SettingsShadowSystemProperties.set(
AutomaticStorageManagementSwitchPreferenceController
.STORAGE_MANAGER_ENABLED_BY_DEFAULT_PROPERTY,
"true");
Settings.Secure.putInt(
mContext.getContentResolver(),
Settings.Secure.AUTOMATIC_STORAGE_MANAGER_TURNED_OFF_BY_POLICY,
1);
mController.onSwitchToggled(true);
verify(transaction).add(any(), eq(ActivationWarningFragment.TAG));
}
}