Search in sources :

Example 56 with ShadowUserManager

use of org.robolectric.shadows.ShadowUserManager in project android_packages_apps_Settings by AOSPA.

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 57 with ShadowUserManager

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

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 58 with ShadowUserManager

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

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)

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