Search in sources :

Example 1 with ShadowUserManager

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

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, "mWifiPreferenceController", mWifiPreferenceController);
    ReflectionHelpers.setField(mController, "mMobileNetworkPreferenceController", mMobileNetworkPreferenceController);
    ReflectionHelpers.setField(mController, "mTetherPreferenceController", mTetherPreferenceController);
}
Also used : ShadowUserManager(org.robolectric.shadows.ShadowUserManager) UserManager(android.os.UserManager) ShadowUserManager(org.robolectric.shadows.ShadowUserManager) Before(org.junit.Before)

Example 2 with ShadowUserManager

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

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

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

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

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

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

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

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)

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