summaryrefslogtreecommitdiffstats
path: root/keystore/tests/src/android/security/KeyStoreTest.java
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2011-06-27 17:22:02 -0700
committerBrian Carlstrom <bdc@google.com>2011-06-27 17:22:02 -0700
commitbef5e5aabcb6ab440829f4418d1cbc268564eee0 (patch)
treec2312f4e06065bec972b66f0ad292ca0fdca5fbc /keystore/tests/src/android/security/KeyStoreTest.java
parent5106476bbf2a8e89b47e91d60e20fd38f7fa7e85 (diff)
downloadframeworks_base-bef5e5aabcb6ab440829f4418d1cbc268564eee0.zip
frameworks_base-bef5e5aabcb6ab440829f4418d1cbc268564eee0.tar.gz
frameworks_base-bef5e5aabcb6ab440829f4418d1cbc268564eee0.tar.bz2
Add KeyStoreTest.testGet
Now that system user can read keystore, add KeyStoreTest.testGet and update other tests to use KeyStore.get Change-Id: I364866d52c2ecf550ff26aadc6e85126318889fa
Diffstat (limited to 'keystore/tests/src/android/security/KeyStoreTest.java')
-rwxr-xr-xkeystore/tests/src/android/security/KeyStoreTest.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/keystore/tests/src/android/security/KeyStoreTest.java b/keystore/tests/src/android/security/KeyStoreTest.java
index 4582aa0..15e253c 100755
--- a/keystore/tests/src/android/security/KeyStoreTest.java
+++ b/keystore/tests/src/android/security/KeyStoreTest.java
@@ -75,11 +75,21 @@ public class KeyStoreTest extends ActivityUnitTestCase<Activity> {
assertEquals(KeyStore.State.UNLOCKED, mKeyStore.state());
}
+ public void testGet() throws Exception {
+ assertNull(mKeyStore.get(TEST_KEYNAME));
+ mKeyStore.password(TEST_PASSWD);
+ assertNull(mKeyStore.get(TEST_KEYNAME));
+ assertTrue(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE));
+ assertTrue(Arrays.equals(TEST_KEYVALUE, mKeyStore.get(TEST_KEYNAME)));
+ }
+
public void testPut() throws Exception {
+ assertNull(mKeyStore.get(TEST_KEYNAME));
assertFalse(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE));
assertFalse(mKeyStore.contains(TEST_KEYNAME));
mKeyStore.password(TEST_PASSWD);
assertTrue(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE));
+ assertTrue(Arrays.equals(TEST_KEYVALUE, mKeyStore.get(TEST_KEYNAME)));
}
public void testI18n() throws Exception {
@@ -96,7 +106,9 @@ public class KeyStoreTest extends ActivityUnitTestCase<Activity> {
assertTrue(mKeyStore.delete(TEST_KEYNAME));
mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE);
+ assertTrue(Arrays.equals(TEST_KEYVALUE, mKeyStore.get(TEST_KEYNAME)));
assertTrue(mKeyStore.delete(TEST_KEYNAME));
+ assertNull(mKeyStore.get(TEST_KEYNAME));
}
public void testContains() throws Exception {