Search in sources :

Example 1 with BarChartPreference

use of com.android.settingslib.widget.BarChartPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class PermissionBarChartPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    final Context context = RuntimeEnvironment.application;
    final UserManager userManager = context.getSystemService(UserManager.class);
    final ShadowUserManager shadowUserManager = Shadow.extract(userManager);
    final ShadowAccessibilityManager accessibilityManager = Shadow.extract(AccessibilityManager.getInstance(context));
    accessibilityManager.setEnabledAccessibilityServiceList(new ArrayList<>());
    shadowUserManager.addProfile(new UserInfo(123, null, 0));
    when(FakeFeatureFactory.setupForTest().securityFeatureProvider.getLockPatternUtils(any(Context.class))).thenReturn(mLockPatternUtils);
    mController = spy(new PermissionBarChartPreferenceController(context, "test_key"));
    mFragment = spy(FragmentController.of(new PrivacyDashboardFragment()).create().start().get());
    mController.setFragment(mFragment);
    mPreference = spy(new BarChartPreference(context));
    when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn((BarChartPreference) mPreference);
}
Also used : Context(android.content.Context) ShadowUserManager(com.android.settings.testutils.shadow.ShadowUserManager) ShadowAccessibilityManager(org.robolectric.shadows.ShadowAccessibilityManager) BarChartPreference(com.android.settingslib.widget.BarChartPreference) UserManager(android.os.UserManager) ShadowUserManager(com.android.settings.testutils.shadow.ShadowUserManager) UserInfo(android.content.pm.UserInfo) Before(org.junit.Before)

Aggregations

Context (android.content.Context)1 UserInfo (android.content.pm.UserInfo)1 UserManager (android.os.UserManager)1 ShadowUserManager (com.android.settings.testutils.shadow.ShadowUserManager)1 BarChartPreference (com.android.settingslib.widget.BarChartPreference)1 Before (org.junit.Before)1 ShadowAccessibilityManager (org.robolectric.shadows.ShadowAccessibilityManager)1