Search in sources :

Example 21 with ShadowUserManager

use of com.android.settings.testutils.shadow.ShadowUserManager in project android_packages_apps_Settings by omnirom.

the class AccountDetailDashboardFragmentTest method onResume_accountPresentOneProfile_shouldNotFinish.

@Test
public void onResume_accountPresentOneProfile_shouldNotFinish() {
    ShadowUserManager userManager = Shadow.extract(mContext.getSystemService(UserManager.class));
    userManager.addUserProfile(new UserHandle(1));
    ShadowAccountManager.addAccountForUser(1, mFragment.mAccount);
    mFragment.finishIfAccountMissing();
    verify(mFragment, never()).finish();
}
Also used : ShadowUserManager(com.android.settings.testutils.shadow.ShadowUserManager) UserManager(android.os.UserManager) ShadowUserManager(com.android.settings.testutils.shadow.ShadowUserManager) UserHandle(android.os.UserHandle) Test(org.junit.Test)

Example 22 with ShadowUserManager

use of com.android.settings.testutils.shadow.ShadowUserManager in project android_packages_apps_Settings by omnirom.

the class AccountDetailDashboardFragmentTest method onResume_accountPresentTwoProfiles_shouldNotFinish.

@Test
public void onResume_accountPresentTwoProfiles_shouldNotFinish() {
    ShadowUserManager userManager = Shadow.extract(mContext.getSystemService(UserManager.class));
    userManager.addUserProfile(new UserHandle(1));
    userManager.addUserProfile(new UserHandle(2));
    ShadowAccountManager.addAccountForUser(1, new Account("test@test.com", "com.test"));
    ShadowAccountManager.addAccountForUser(2, mFragment.mAccount);
    mFragment.finishIfAccountMissing();
    verify(mFragment, never()).finish();
}
Also used : ShadowUserManager(com.android.settings.testutils.shadow.ShadowUserManager) Account(android.accounts.Account) UserManager(android.os.UserManager) ShadowUserManager(com.android.settings.testutils.shadow.ShadowUserManager) UserHandle(android.os.UserHandle) Test(org.junit.Test)

Aggregations

UserManager (android.os.UserManager)22 ShadowUserManager (com.android.settings.testutils.shadow.ShadowUserManager)22 Test (org.junit.Test)21 UserHandle (android.os.UserHandle)7 ComponentName (android.content.ComponentName)6 ContextWrapper (android.content.ContextWrapper)6 ApplicationInfo (android.content.pm.ApplicationInfo)6 AppStateInstallAppsBridge (com.android.settings.applications.AppStateInstallAppsBridge)6 InstallAppsState (com.android.settings.applications.AppStateInstallAppsBridge.InstallAppsState)6 EnforcedAdmin (com.android.settingslib.RestrictedLockUtils.EnforcedAdmin)6 ShadowDevicePolicyManager (com.android.settings.testutils.shadow.ShadowDevicePolicyManager)5 Account (android.accounts.Account)4 UserInfo (android.content.pm.UserInfo)4 ViewGroup (android.view.ViewGroup)4 FrameLayout (android.widget.FrameLayout)4 TextView (android.widget.TextView)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 ConnectivityManager (android.net.ConnectivityManager)2 AlertDialog (androidx.appcompat.app.AlertDialog)2 ShadowConnectivityManager (com.android.settings.testutils.shadow.ShadowConnectivityManager)2