Search in sources :

Example 66 with Preference

use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class EnableContentCapturePreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mController = new EnableContentCapturePreferenceController(mContext, "THE_KEY_TO_SUCCESS");
    mPreference = new Preference(mContext);
    mPreference.setKey(mController.getPreferenceKey());
}
Also used : Preference(androidx.preference.Preference) Before(org.junit.Before)

Example 67 with Preference

use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WorkPolicyInfoPreferenceControllerTest method handlePreferenceTreeClick_matchingKey_shouldShowWorkPolicyInfo.

@Test
public void handlePreferenceTreeClick_matchingKey_shouldShowWorkPolicyInfo() {
    when(mEnterpriseProvider.hasWorkPolicyInfo()).thenReturn(true);
    WorkPolicyInfoPreferenceController controller = new WorkPolicyInfoPreferenceController(mContext, "test_key");
    final Preference pref = new Preference(mContext);
    pref.setKey(controller.getPreferenceKey());
    assertThat(controller.handlePreferenceTreeClick(pref)).isTrue();
    verify(mEnterpriseProvider).showWorkPolicyInfo();
}
Also used : Preference(androidx.preference.Preference) Test(org.junit.Test)

Example 68 with Preference

use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class EncryptionStatusPreferenceControllerTest method setUp.

@Before
public void setUp() {
    mContext = RuntimeEnvironment.application;
    mController = new EncryptionStatusPreferenceController(mContext, PREF_KEY_ENCRYPTION_DETAIL_PAGE);
    mShadowUserManager = ShadowUserManager.getShadow();
    mPreference = new Preference(mContext);
}
Also used : Preference(androidx.preference.Preference) Before(org.junit.Before)

Example 69 with Preference

use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class TrustAgentListPreferenceControllerTest method onResume_shouldClearOldAgents.

@Test
public void onResume_shouldClearOldAgents() {
    final Preference oldAgent = new Preference(mActivity);
    oldAgent.setKey(PREF_KEY_TRUST_AGENT);
    when(mCategory.findPreference(PREF_KEY_TRUST_AGENT)).thenReturn(oldAgent).thenReturn(null);
    mController.displayPreference(mScreen);
    mController.onResume();
    verify(mCategory).removePreference(oldAgent);
}
Also used : Preference(androidx.preference.Preference) Test(org.junit.Test)

Example 70 with Preference

use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ShowPasswordPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mFeatureFactory = FakeFeatureFactory.setupForTest();
    when(mFeatureFactory.securityFeatureProvider.getLockPatternUtils(mContext)).thenReturn(mLockPatternUtils);
    mController = new ShowPasswordPreferenceController(mContext);
    mPreference = new Preference(mContext);
    mPreference.setKey(mController.getPreferenceKey());
    when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
}
Also used : Preference(androidx.preference.Preference) Before(org.junit.Before)

Aggregations

Preference (androidx.preference.Preference)863 Test (org.junit.Test)343 Before (org.junit.Before)164 Intent (android.content.Intent)81 PreferenceScreen (androidx.preference.PreferenceScreen)81 NotificationChannel (android.app.NotificationChannel)77 SwitchPreference (androidx.preference.SwitchPreference)75 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)69 Context (android.content.Context)60 ArrayList (java.util.ArrayList)50 NotificationBackend (com.android.settings.notification.NotificationBackend)45 ListPreference (androidx.preference.ListPreference)43 PreferenceCategory (androidx.preference.PreferenceCategory)40 Tile (com.android.settingslib.drawer.Tile)40 PreferenceManager (androidx.preference.PreferenceManager)39 Activity (android.app.Activity)27 UserHandle (android.os.UserHandle)27 FooterPreference (com.android.settingslib.widget.FooterPreference)27 PackageManager (android.content.pm.PackageManager)26 Bundle (android.os.Bundle)24