Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61ab48f3 authored by Rubin Xu's avatar Rubin Xu
Browse files

Fix flaky unit test

Bug: 140308162
Test: atest --generate-new-metrics 100 SyntheticPasswordTests#testTokenBasedResetPassword
Change-Id: I07281f8689a259786ba939a84442e010656a8169
parent 2aed1f37
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import android.os.RemoteException;
import android.os.UserHandle;
import android.platform.test.annotations.Presubmit;

import androidx.test.filters.FlakyTest;
import androidx.test.filters.SmallTest;

import com.android.internal.widget.LockPatternUtils;
@@ -337,13 +336,15 @@ public class SyntheticPasswordTests extends BaseLockSettingsServiceTests {
        assertTrue(hasSyntheticPassword(MANAGED_PROFILE_USER_ID));
    }

    @FlakyTest(bugId = 140308162)
    public void testTokenBasedResetPassword() throws RemoteException {
        final byte[] password = "password".getBytes();
        final byte[] pattern = "123654".getBytes();
        final byte[] token = "some-high-entropy-secure-token".getBytes();
        initializeCredentialUnderSP(password, PRIMARY_USER_ID);
        // Disregard any reportPasswordChanged() invocations as part of credential setup.
        flushHandlerTasks();
        reset(mDevicePolicyManager);

        final byte[] storageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);

        assertFalse(mService.hasPendingEscrowToken(PRIMARY_USER_ID));