Loading services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverySnapshotStorageTest.java +22 −9 Original line number Original line Diff line number Diff line Loading @@ -7,23 +7,19 @@ import android.security.keystore.recovery.KeyChainSnapshot; import android.support.test.filters.SmallTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.support.test.runner.AndroidJUnit4; import com.android.server.locksettings.recoverablekeystore.TestData; import org.junit.Test; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runner.RunWith; import java.security.cert.CertificateException; import java.util.ArrayList; import java.util.ArrayList; @SmallTest @SmallTest @RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class) public class RecoverySnapshotStorageTest { public class RecoverySnapshotStorageTest { private static final KeyChainSnapshot MINIMAL_KEYCHAIN_SNAPSHOT = new KeyChainSnapshot.Builder() private static final KeyChainSnapshot MINIMAL_KEYCHAIN_SNAPSHOT = .setCounterId(1) createMinimalKeyChainSnapshot(); .setSnapshotVersion(1) .setServerParams(new byte[0]) .setMaxAttempts(10) .setEncryptedRecoveryKeyBlob(new byte[0]) .setKeyChainProtectionParams(new ArrayList<>()) .setWrappedApplicationKeys(new ArrayList<>()) .build(); private final RecoverySnapshotStorage mRecoverySnapshotStorage = new RecoverySnapshotStorage(); private final RecoverySnapshotStorage mRecoverySnapshotStorage = new RecoverySnapshotStorage(); Loading @@ -50,4 +46,21 @@ public class RecoverySnapshotStorageTest { assertNull(mRecoverySnapshotStorage.get(1000)); 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); } } } } Loading
services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverySnapshotStorageTest.java +22 −9 Original line number Original line Diff line number Diff line Loading @@ -7,23 +7,19 @@ import android.security.keystore.recovery.KeyChainSnapshot; import android.support.test.filters.SmallTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.support.test.runner.AndroidJUnit4; import com.android.server.locksettings.recoverablekeystore.TestData; import org.junit.Test; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runner.RunWith; import java.security.cert.CertificateException; import java.util.ArrayList; import java.util.ArrayList; @SmallTest @SmallTest @RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class) public class RecoverySnapshotStorageTest { public class RecoverySnapshotStorageTest { private static final KeyChainSnapshot MINIMAL_KEYCHAIN_SNAPSHOT = new KeyChainSnapshot.Builder() private static final KeyChainSnapshot MINIMAL_KEYCHAIN_SNAPSHOT = .setCounterId(1) createMinimalKeyChainSnapshot(); .setSnapshotVersion(1) .setServerParams(new byte[0]) .setMaxAttempts(10) .setEncryptedRecoveryKeyBlob(new byte[0]) .setKeyChainProtectionParams(new ArrayList<>()) .setWrappedApplicationKeys(new ArrayList<>()) .build(); private final RecoverySnapshotStorage mRecoverySnapshotStorage = new RecoverySnapshotStorage(); private final RecoverySnapshotStorage mRecoverySnapshotStorage = new RecoverySnapshotStorage(); Loading @@ -50,4 +46,21 @@ public class RecoverySnapshotStorageTest { assertNull(mRecoverySnapshotStorage.get(1000)); 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); } } } }