Merge "Re-enable biometric prompt tests." into tm-dev

This commit is contained in:
TreeHugger Robot
2022-03-25 01:31:10 +00:00
committed by Android (Google) Code Review

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();