Update tests for mandatory biometrics
Flag: android.hardware.biometrics.Flag.MANDATORY_BIOMETRICS Fixes: 352036009 Test: atest MainClearTest CombinedBiometricProfileSettingsTest Change-Id: If778dcb138b82814621186ddd7f89d77dc4a9b18
This commit is contained in:
@@ -138,7 +138,11 @@ public class MainClearTest {
|
|||||||
// Make scrollView only have one child
|
// Make scrollView only have one child
|
||||||
when(mScrollView.getChildAt(0)).thenReturn(mLinearLayout);
|
when(mScrollView.getChildAt(0)).thenReturn(mLinearLayout);
|
||||||
when(mScrollView.getChildCount()).thenReturn(1);
|
when(mScrollView.getChildCount()).thenReturn(1);
|
||||||
doReturn(mActivity).when(mMainClear).getActivity();
|
doReturn(mMockActivity).when(mMainClear).getActivity();
|
||||||
|
when(mMockActivity.getSystemService(BiometricManager.class)).thenReturn(mBiometricManager);
|
||||||
|
when(mBiometricManager.canAuthenticate(
|
||||||
|
BiometricManager.Authenticators.MANDATORY_BIOMETRICS))
|
||||||
|
.thenReturn(BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
|||||||
@@ -31,9 +31,11 @@ import static org.mockito.Mockito.mock;
|
|||||||
import static org.mockito.Mockito.never;
|
import static org.mockito.Mockito.never;
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.hardware.biometrics.BiometricManager;
|
||||||
import android.hardware.face.FaceManager;
|
import android.hardware.face.FaceManager;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -102,6 +104,8 @@ public class CombinedBiometricProfileSettingsTest {
|
|||||||
private FaceStatusPreferenceController mFaceStatusPreferenceController;
|
private FaceStatusPreferenceController mFaceStatusPreferenceController;
|
||||||
@Mock
|
@Mock
|
||||||
private FaceManager mFaceManager;
|
private FaceManager mFaceManager;
|
||||||
|
@Mock
|
||||||
|
private BiometricManager mBiometricManager;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
@@ -114,6 +118,10 @@ public class CombinedBiometricProfileSettingsTest {
|
|||||||
mContext = spy(ApplicationProvider.getApplicationContext());
|
mContext = spy(ApplicationProvider.getApplicationContext());
|
||||||
mFragment = spy(new TestCombinedBiometricProfileSettings(mContext));
|
mFragment = spy(new TestCombinedBiometricProfileSettings(mContext));
|
||||||
doReturn(mActivity).when(mFragment).getActivity();
|
doReturn(mActivity).when(mFragment).getActivity();
|
||||||
|
doReturn(mBiometricManager).when(mActivity).getSystemService(BiometricManager.class);
|
||||||
|
when(mBiometricManager.canAuthenticate(
|
||||||
|
BiometricManager.Authenticators.MANDATORY_BIOMETRICS))
|
||||||
|
.thenReturn(BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE);
|
||||||
|
|
||||||
ReflectionHelpers.setField(mFragment, "mDashboardFeatureProvider",
|
ReflectionHelpers.setField(mFragment, "mDashboardFeatureProvider",
|
||||||
FakeFeatureFactory.setupForTest().dashboardFeatureProvider);
|
FakeFeatureFactory.setupForTest().dashboardFeatureProvider);
|
||||||
|
|||||||
Reference in New Issue
Block a user