Inject different User IDs into biometric utils

Test: atest SettingsUnitTests

Bug: 222217132
Change-Id: I7939d78817f53814d0f8fb4636231a4833fbe26a
This commit is contained in:
Yuri Ufimtsev
2022-03-07 09:20:57 +00:00
parent bdd37ce348
commit f15bebe6c3
13 changed files with 38 additions and 25 deletions

View File

@@ -64,7 +64,7 @@ public class BiometricNavigationUtilsTest {
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(UserManager.class)).thenReturn(mUserManager);
doNothing().when(mContext).startActivity(any());
mBiometricNavigationUtils = new BiometricNavigationUtils();
mBiometricNavigationUtils = new BiometricNavigationUtils(UserHandle.myUserId());
}
@Test

View File

@@ -56,7 +56,8 @@ public class CombinedBiometricStatusUtilsTest {
private static final ComponentName COMPONENT_NAME =
new ComponentName("package", "class");
private static final UserHandle USER_HANDLE = new UserHandle(UserHandle.myUserId());
private static final int USER_ID = UserHandle.myUserId();
private static final UserHandle USER_HANDLE = new UserHandle(USER_ID);;
@Mock
@@ -85,7 +86,8 @@ public class CombinedBiometricStatusUtilsTest {
when(mApplicationContext.getSystemService(Context.DEVICE_POLICY_SERVICE))
.thenReturn(mDevicePolicyManager);
when(mApplicationContext.getSystemService(Context.FACE_SERVICE)).thenReturn(mFaceManager);
mCombinedBiometricStatusUtils = new CombinedBiometricStatusUtils(mApplicationContext);
mCombinedBiometricStatusUtils = new CombinedBiometricStatusUtils(
mApplicationContext, USER_ID);
}
@Test

View File

@@ -49,7 +49,8 @@ public class FaceStatusUtilsTest {
private static final ComponentName COMPONENT_NAME =
new ComponentName("package", "class");
private static final UserHandle USER_HANDLE = new UserHandle(UserHandle.myUserId());
private static final int USER_ID = UserHandle.myUserId();
private static final UserHandle USER_HANDLE = new UserHandle(USER_ID);
@Mock
@@ -78,7 +79,7 @@ public class FaceStatusUtilsTest {
when(mApplicationContext.getSystemService(Context.DEVICE_POLICY_SERVICE))
.thenReturn(mDevicePolicyManager);
when(mApplicationContext.getSystemService(Context.FACE_SERVICE)).thenReturn(mFaceManager);
mFaceStatusUtils = new FaceStatusUtils(mApplicationContext, mFaceManager);
mFaceStatusUtils = new FaceStatusUtils(mApplicationContext, mFaceManager, USER_ID);
}
@Test

View File

@@ -52,7 +52,8 @@ public class FingerprintStatusUtilsTest {
private static final ComponentName COMPONENT_NAME =
new ComponentName("package", "class");
private static final UserHandle USER_HANDLE = new UserHandle(UserHandle.myUserId());
private static final int USER_ID = UserHandle.myUserId();
private static final UserHandle USER_HANDLE = new UserHandle(USER_ID);
@Mock
@@ -82,7 +83,7 @@ public class FingerprintStatusUtilsTest {
.thenReturn(mDevicePolicyManager);
when(mApplicationContext.getSystemService(Context.FACE_SERVICE)).thenReturn(mFaceManager);
mFingerprintStatusUtils =
new FingerprintStatusUtils(mApplicationContext, mFingerprintManager);
new FingerprintStatusUtils(mApplicationContext, mFingerprintManager, USER_ID);
}
@Test