Search in sources :

Example 6 with ShadowAccessibilityManager

use of org.robolectric.shadows.ShadowAccessibilityManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

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());
    SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
}
Also used : ShadowAccessibilityManager(org.robolectric.shadows.ShadowAccessibilityManager) AccessibilityManager(android.view.accessibility.AccessibilityManager) ShadowAccessibilityManager(org.robolectric.shadows.ShadowAccessibilityManager) Before(org.junit.Before)

Example 7 with ShadowAccessibilityManager

use of org.robolectric.shadows.ShadowAccessibilityManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SlicesDatabaseAccessorTest method setUp.

@Before
public void setUp() {
    mContext = RuntimeEnvironment.application;
    ShadowUserManager.getShadow().setIsAdminUser(true);
    mAccessor = spy(new SlicesDatabaseAccessor(mContext));
    mDb = SlicesDatabaseHelper.getInstance(mContext).getWritableDatabase();
    SlicesDatabaseHelper.getInstance(mContext).setIndexedState();
    // Register the fake a11y Service
    ShadowAccessibilityManager shadowAccessibilityManager = Shadow.extract(RuntimeEnvironment.application.getSystemService(AccessibilityManager.class));
    shadowAccessibilityManager.setInstalledAccessibilityServiceList(new ArrayList<>());
}
Also used : ShadowAccessibilityManager(org.robolectric.shadows.ShadowAccessibilityManager) AccessibilityManager(android.view.accessibility.AccessibilityManager) ShadowAccessibilityManager(org.robolectric.shadows.ShadowAccessibilityManager) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)7 ShadowAccessibilityManager (org.robolectric.shadows.ShadowAccessibilityManager)7 AccessibilityManager (android.view.accessibility.AccessibilityManager)6 ContentResolver (android.content.ContentResolver)2 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