Merge "Don't show warning dialog on opening ASM settings." into oc-dev am: 81f98a8fd5

am: c7734f589e

Change-Id: Idc4760b31fa82f2e5387225f3da7c621a8decf4c
This commit is contained in:
Daniel Nishi
2017-04-20 18:53:59 +00:00
committed by android-build-merger
3 changed files with 51 additions and 3 deletions

View File

@@ -16,6 +16,8 @@
package com.android.settings.deletionhelper;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
@@ -27,6 +29,7 @@ import static org.mockito.Mockito.verify;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Context;
import android.provider.Settings;
import android.support.v7.preference.Preference;
import com.android.internal.logging.nano.MetricsProto;
@@ -121,4 +124,41 @@ public class AutomaticStorageManagerSwitchBarControllerTest {
verify(mFragmentManager.beginTransaction(), never())
.add(any(Fragment.class), eq(ActivationWarningFragment.TAG));
}
@Test
public void initializeSwitchOnConstruction() {
Settings.Secure.putInt(
mContext.getContentResolver(),
Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED,
1);
mController =
new AutomaticStorageManagerSwitchBarController(
mContext,
mSwitchBar,
mMetricsFeatureProvider,
mPreference,
mFragmentManager);
assertThat(mSwitchBar.isChecked()).isTrue();
}
@Test
public void initializingSwitchDoesNotTriggerView() {
Settings.Secure.putInt(
mContext.getContentResolver(),
Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED,
1);
mController =
new AutomaticStorageManagerSwitchBarController(
mContext,
mSwitchBar,
mMetricsFeatureProvider,
mPreference,
mFragmentManager);
verify(mFragmentManager.beginTransaction(), never())
.add(any(Fragment.class), eq(ActivationWarningFragment.TAG));
}
}