Search in sources :

Example 46 with ShadowUserManager

use of org.robolectric.shadows.ShadowUserManager in project packages_apps_Settings by PixelExperience.

the class RedactionInterstitialTest method managedProfileNoRestrictionsTest.

@Test
public void managedProfileNoRestrictionsTest() {
    setupSettings(1, /* show */
    1);
    final ShadowUserManager sum = Shadow.extract(RuntimeEnvironment.application.getSystemService(UserManager.class));
    sum.addProfile(UserHandle.myUserId(), UserHandle.myUserId(), "work-profile", /* profileName */
    UserInfo.FLAG_MANAGED_PROFILE);
    setupActivity();
    assertHideAllVisible(false);
    assertEnabledButtons(true, /* all */
    true);
    assertSelectedButton(R.id.show_all);
}
Also used : ShadowUserManager(org.robolectric.shadows.ShadowUserManager) ShadowUserManager(org.robolectric.shadows.ShadowUserManager) UserManager(android.os.UserManager) Test(org.junit.Test)

Example 47 with ShadowUserManager

use of org.robolectric.shadows.ShadowUserManager in project android_packages_apps_Settings by Project-Kaleidoscope.

the class TopLevelNetworkEntryPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    final ShadowUserManager um = Shadows.shadowOf(RuntimeEnvironment.application.getSystemService(UserManager.class));
    um.setIsAdminUser(true);
    mController = new TopLevelNetworkEntryPreferenceController(mContext, "test_key");
    ReflectionHelpers.setField(mController, "mMobileNetworkPreferenceController", mMobileNetworkPreferenceController);
}
Also used : ShadowUserManager(org.robolectric.shadows.ShadowUserManager) UserManager(android.os.UserManager) ShadowUserManager(org.robolectric.shadows.ShadowUserManager) Before(org.junit.Before)

Example 48 with ShadowUserManager

use of org.robolectric.shadows.ShadowUserManager in project android_packages_apps_Settings by Project-Kaleidoscope.

the class DevelopmentTilesTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mService = spy(Robolectric.setupService(DevelopmentTiles.ShowLayout.class));
    final ShadowUserManager um = Shadows.shadowOf(RuntimeEnvironment.application.getSystemService(UserManager.class));
    um.setIsAdminUser(true);
    doReturn(mTile).when(mService).getQsTile();
}
Also used : ShadowUserManager(org.robolectric.shadows.ShadowUserManager) UserManager(android.os.UserManager) ShadowUserManager(org.robolectric.shadows.ShadowUserManager) Before(org.junit.Before)

Example 49 with ShadowUserManager

use of org.robolectric.shadows.ShadowUserManager in project android_packages_apps_Settings by Project-Kaleidoscope.

the class RedactionInterstitialTest method managedProfileUnredactedRestrictionTest.

@Test
public void managedProfileUnredactedRestrictionTest() {
    setupSettings(1, /* show */
    1);
    final ShadowUserManager sum = Shadow.extract(RuntimeEnvironment.application.getSystemService(UserManager.class));
    sum.addProfile(UserHandle.myUserId(), UserHandle.myUserId(), "work-profile", /* profileName */
    UserInfo.FLAG_MANAGED_PROFILE);
    ShadowRestrictedLockUtilsInternal.setKeyguardDisabledFeatures(KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS);
    setupActivity();
    assertHideAllVisible(false);
    assertEnabledButtons(false, /* all */
    true);
    assertSelectedButton(R.id.redact_sensitive);
}
Also used : ShadowUserManager(org.robolectric.shadows.ShadowUserManager) ShadowUserManager(org.robolectric.shadows.ShadowUserManager) UserManager(android.os.UserManager) Test(org.junit.Test)

Example 50 with ShadowUserManager

use of org.robolectric.shadows.ShadowUserManager in project android_packages_apps_Launcher3 by crdroidandroid.

the class SDWorkModeTest method testAllAppsList_workProfile.

@Test
public void testAllAppsList_workProfile() throws Exception {
    ShadowUserManager sum = Shadow.extract(mTargetContext.getSystemService(UserManager.class));
    sum.addUser(SYSTEM_USER, "me", FLAG_SYSTEM);
    sum.addProfile(SYSTEM_USER, WORK_PROFILE_ID, "work", FLAG_PROFILE);
    SecondaryDisplayLauncher launcher = loadLauncher();
    launcher.showAppDrawer(true);
    doLayout(launcher);
    AllAppsRecyclerView rv1 = launcher.getAppsView().getActiveRecyclerView();
    verifyRecyclerViewCount(rv1);
    assertNotNull(launcher.getAppsView().getWorkModeSwitch());
    assertTrue(launcher.getAppsView().getRecyclerViewContainer() instanceof AllAppsPagedView);
    AllAppsPagedView pagedView = (AllAppsPagedView) launcher.getAppsView().getRecyclerViewContainer();
    pagedView.snapToPageImmediately(1);
    doLayout(launcher);
    AllAppsRecyclerView rv2 = launcher.getAppsView().getActiveRecyclerView();
    verifyRecyclerViewCount(rv2);
    assertNotSame(rv1, rv2);
}
Also used : ShadowUserManager(org.robolectric.shadows.ShadowUserManager) AllAppsRecyclerView(com.android.launcher3.allapps.AllAppsRecyclerView) UserManager(android.os.UserManager) ShadowUserManager(org.robolectric.shadows.ShadowUserManager) AllAppsPagedView(com.android.launcher3.allapps.AllAppsPagedView) Test(org.junit.Test)

Aggregations

UserManager (android.os.UserManager)58 ShadowUserManager (org.robolectric.shadows.ShadowUserManager)58 Test (org.junit.Test)30 Before (org.junit.Before)28 AllAppsPagedView (com.android.launcher3.allapps.AllAppsPagedView)2 AllAppsRecyclerView (com.android.launcher3.allapps.AllAppsRecyclerView)2