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

Commit b4b4dad8 authored by Robert Berry's avatar Robert Berry Committed by android-build-merger
Browse files

Merge "Fix broken test RecoverySnapshotStorageTest" into pi-dev am: 7dd666f4

am: 0ada8670

Change-Id: Ic88ee04645ee3ff352a7fe918f79c69c42096551
parents 70a6ab19 0ada8670
Loading
Loading
Loading
Loading
+22 −9
Original line number Diff line number Diff line
@@ -7,23 +7,19 @@ import android.security.keystore.recovery.KeyChainSnapshot;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;

import com.android.server.locksettings.recoverablekeystore.TestData;

import org.junit.Test;
import org.junit.runner.RunWith;

import java.security.cert.CertificateException;
import java.util.ArrayList;

@SmallTest
@RunWith(AndroidJUnit4.class)
public class RecoverySnapshotStorageTest {
    private static final KeyChainSnapshot MINIMAL_KEYCHAIN_SNAPSHOT = new KeyChainSnapshot.Builder()
            .setCounterId(1)
            .setSnapshotVersion(1)
            .setServerParams(new byte[0])
            .setMaxAttempts(10)
            .setEncryptedRecoveryKeyBlob(new byte[0])
            .setKeyChainProtectionParams(new ArrayList<>())
            .setWrappedApplicationKeys(new ArrayList<>())
            .build();
    private static final KeyChainSnapshot MINIMAL_KEYCHAIN_SNAPSHOT =
            createMinimalKeyChainSnapshot();

    private final RecoverySnapshotStorage mRecoverySnapshotStorage = new RecoverySnapshotStorage();

@@ -50,4 +46,21 @@ public class RecoverySnapshotStorageTest {

        assertNull(mRecoverySnapshotStorage.get(1000));
    }

    private static KeyChainSnapshot createMinimalKeyChainSnapshot() {
        try {
            return new KeyChainSnapshot.Builder()
                    .setCounterId(1)
                    .setSnapshotVersion(1)
                    .setServerParams(new byte[0])
                    .setMaxAttempts(10)
                    .setEncryptedRecoveryKeyBlob(new byte[0])
                    .setKeyChainProtectionParams(new ArrayList<>())
                    .setWrappedApplicationKeys(new ArrayList<>())
                    .setTrustedHardwareCertPath(TestData.CERT_PATH_1)
                    .build();
        } catch (CertificateException e) {
            throw new RuntimeException(e);
        }
    }
}