Re-enable biometric prompt tests.

These were temporarily disabled when the face-to-fingerprint flow was replaced with the coex flow. The test refactor caused presubmit failures because the detach method was not called after the test ended, which could cause unrelated downstream tests to fail.

Bug: 222119218
Test: atest AuthBiometricViewTest
Change-Id: Ie6c18ab2fabe6f42cff9706ad51062ebbad82bd0
This commit is contained in:
Joe Bolinger
2022-03-23 15:12:49 -07:00
parent ad7242029d
commit 05c96d4b32

View File

@@ -42,6 +42,7 @@ import android.view.View;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
@@ -50,7 +51,6 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
@Ignore
@RunWith(AndroidTestingRunner.class)
@RunWithLooper
@SmallTest
@@ -66,6 +66,11 @@ public class AuthBiometricViewTest extends SysuiTestCase {
private AuthBiometricView mBiometricView;
@After
public void tearDown() {
destroyDialog();
}
@Test
public void testOnAuthenticationSucceeded_noConfirmationRequired_sendsActionAuthenticated() {
initDialog(false /* allowDeviceCredential */, mCallback);
@@ -245,6 +250,7 @@ public class AuthBiometricViewTest extends SysuiTestCase {
// TODO: Test dialog size. Should move requireConfirmation to buildBiometricPromptBundle
// Create new dialog and restore the previous state into it
destroyDialog();
initDialog(false /* allowDeviceCredential */, mCallback, state, 10000);
mBiometricView.mAnimationDurationHideDialog = 10000;
mBiometricView.setRequireConfirmation(requireConfirmation);
@@ -304,6 +310,12 @@ public class AuthBiometricViewTest extends SysuiTestCase {
waitForIdleSync();
}
private void destroyDialog() {
if (mBiometricView != null && mBiometricView.isAttachedToWindow()) {
ViewUtils.detachView(mBiometricView);
}
}
@Override
protected void waitForIdleSync() {
TestableLooper.get(this).processAllMessages();