diff options
author | Kenny Root <kroot@google.com> | 2013-02-04 15:10:22 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-02-04 15:10:22 -0800 |
commit | 516fab2404f550aca03b3774bd5b279d4e69dd9f (patch) | |
tree | 1277c2393a27b7146cae657e1bfc6e5a336dc936 /keystore | |
parent | 3789b2fb823b7632e410c0191ddf77dc1e875196 (diff) | |
parent | 133c5f5e91e72cff1a9a3a4903a0efc96b39165b (diff) | |
download | frameworks_base-516fab2404f550aca03b3774bd5b279d4e69dd9f.zip frameworks_base-516fab2404f550aca03b3774bd5b279d4e69dd9f.tar.gz frameworks_base-516fab2404f550aca03b3774bd5b279d4e69dd9f.tar.bz2 |
am 133c5f5e: Merge "AndroidKeyStore: fix tests"
# Via Gerrit Code Review (1) and Kenny Root (1)
* commit '133c5f5e91e72cff1a9a3a4903a0efc96b39165b':
AndroidKeyStore: fix tests
Diffstat (limited to 'keystore')
-rw-r--r-- | keystore/java/android/security/KeyStore.java | 2 | ||||
-rw-r--r-- | keystore/tests/src/android/security/AndroidKeyStoreTest.java | 18 |
2 files changed, 7 insertions, 13 deletions
diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java index 44be804..444dc1d 100644 --- a/keystore/java/android/security/KeyStore.java +++ b/keystore/java/android/security/KeyStore.java @@ -243,7 +243,7 @@ public class KeyStore { */ public long getmtime(String key) { try { - return mBinder.getmtime(key); + return mBinder.getmtime(key) * 1000L; } catch (RemoteException e) { Log.w(TAG, "Cannot connect to keystore", e); return -1L; diff --git a/keystore/tests/src/android/security/AndroidKeyStoreTest.java b/keystore/tests/src/android/security/AndroidKeyStoreTest.java index 49e2f12..056e681 100644 --- a/keystore/tests/src/android/security/AndroidKeyStoreTest.java +++ b/keystore/tests/src/android/security/AndroidKeyStoreTest.java @@ -577,17 +577,14 @@ public class AndroidKeyStoreTest extends AndroidTestCase { assertAliases(new String[] { }); } - public void testKeyStore_DeleteEntry_EmptyStore_Failure() throws Exception { + public void testKeyStore_DeleteEntry_EmptyStore_Success() throws Exception { mKeyStore.load(null, null); - try { - mKeyStore.deleteEntry(TEST_ALIAS_1); - fail("Should throw KeyStoreException with non-existent alias"); - } catch (KeyStoreException success) { - } + // Should not throw when a non-existent entry is requested for delete. + mKeyStore.deleteEntry(TEST_ALIAS_1); } - public void testKeyStore_DeleteEntry_NonExistent_Failure() throws Exception { + public void testKeyStore_DeleteEntry_NonExistent_Success() throws Exception { mKeyStore.load(null, null); // TEST_ALIAS_1 @@ -596,11 +593,8 @@ public class AndroidKeyStoreTest extends AndroidTestCase { assertTrue(mAndroidKeyStore.put(Credentials.USER_CERTIFICATE + TEST_ALIAS_1, FAKE_USER_1)); assertTrue(mAndroidKeyStore.put(Credentials.CA_CERTIFICATE + TEST_ALIAS_1, FAKE_CA_1)); - try { - mKeyStore.deleteEntry(TEST_ALIAS_2); - fail("Should throw KeyStoreException with non-existent alias"); - } catch (KeyStoreException success) { - } + // Should not throw when a non-existent entry is requested for delete. + mKeyStore.deleteEntry(TEST_ALIAS_2); } public void testKeyStore_GetCertificate_Single_Success() throws Exception { |