use of org.robolectric.shadows.ShadowAccessibilityManager in project android_packages_apps_Settings by omnirom.
the class AccessibilitySlicePreferenceControllerTest method setUp.
@Before
public void setUp() {
mContext = RuntimeEnvironment.application;
final ContentResolver contentResolver = mContext.getContentResolver();
Settings.Secure.putInt(contentResolver, Settings.Secure.ACCESSIBILITY_ENABLED, 1);
Settings.Secure.putString(contentResolver, Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, SERVICE_NAME);
// Register the fake a11y Service
ShadowAccessibilityManager shadowAccessibilityManager = Shadow.extract(RuntimeEnvironment.application.getSystemService(AccessibilityManager.class));
shadowAccessibilityManager.setInstalledAccessibilityServiceList(getFakeServiceList());
mController = new AccessibilitySlicePreferenceController(mContext, SERVICE_NAME);
}
use of org.robolectric.shadows.ShadowAccessibilityManager in project android_packages_apps_Settings by omnirom.
the class SettingsSliceProviderTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
// Register the fake a11y Service
ShadowAccessibilityManager shadowAccessibilityManager = Shadow.extract(RuntimeEnvironment.application.getSystemService(AccessibilityManager.class));
shadowAccessibilityManager.setInstalledAccessibilityServiceList(new ArrayList<>());
mProvider = spy(new SettingsSliceProvider());
ShadowStrictMode.reset();
mProvider.mSliceWeakDataCache = new HashMap<>();
mProvider.mSlicesDatabaseAccessor = new SlicesDatabaseAccessor(mContext);
when(mProvider.getContext()).thenReturn(mContext);
SlicesDatabaseHelper.getInstance(mContext).setIndexedState();
doReturn(mManager).when(mContext).getSystemService(SliceManager.class);
when(mManager.getPinnedSlices()).thenReturn(Collections.emptyList());
mPackageManager = Shadows.shadowOf(mContext.getPackageManager());
SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
}
use of org.robolectric.shadows.ShadowAccessibilityManager in project android_packages_apps_Settings by omnirom.
the class SlicesDatabaseAccessorTest method setUp.
@Before
public void setUp() {
mContext = RuntimeEnvironment.application;
ShadowUserManager.getShadow().setIsAdminUser(true);
mAccessor = spy(new SlicesDatabaseAccessor(mContext));
SlicesDatabaseHelper.getInstance(mContext).setIndexedState();
// Register the fake a11y Service
ShadowAccessibilityManager shadowAccessibilityManager = Shadow.extract(RuntimeEnvironment.application.getSystemService(AccessibilityManager.class));
shadowAccessibilityManager.setInstalledAccessibilityServiceList(new ArrayList<>());
}
use of org.robolectric.shadows.ShadowAccessibilityManager 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);
}
use of org.robolectric.shadows.ShadowAccessibilityManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AccessibilitySlicePreferenceControllerTest method setUp.
@Before
public void setUp() {
mContext = RuntimeEnvironment.application;
final ContentResolver contentResolver = mContext.getContentResolver();
Settings.Secure.putInt(contentResolver, Settings.Secure.ACCESSIBILITY_ENABLED, 1);
Settings.Secure.putString(contentResolver, Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, SERVICE_NAME);
// Register the fake a11y Service
ShadowAccessibilityManager shadowAccessibilityManager = Shadow.extract(RuntimeEnvironment.application.getSystemService(AccessibilityManager.class));
shadowAccessibilityManager.setInstalledAccessibilityServiceList(getFakeServiceList());
mController = new AccessibilitySlicePreferenceController(mContext, SERVICE_NAME);
}
Aggregations