diff options
author | Brian Carlstrom <bdc@google.com> | 2011-06-27 17:22:02 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2011-06-27 17:22:02 -0700 |
commit | bef5e5aabcb6ab440829f4418d1cbc268564eee0 (patch) | |
tree | c2312f4e06065bec972b66f0ad292ca0fdca5fbc /keystore | |
parent | 5106476bbf2a8e89b47e91d60e20fd38f7fa7e85 (diff) | |
download | frameworks_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')
-rwxr-xr-x | keystore/tests/src/android/security/KeyStoreTest.java | 12 |
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 { |