Merge "Fix broken test RecoverySnapshotStorageTest" into pi-dev

am: 7dd666f4c5

Change-Id: I7380c5f676f40fead709bc237e59b5eff73ab53b
This commit is contained in:
Robert Berry
2018-03-27 15:08:22 +00:00
committed by android-build-merger

View File

@@ -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);
}
}
}