|
35 | 35 | public class KeyStoreTest extends ActivityUnitTestCase<Activity> { |
36 | 36 | private static final String TEST_PASSWD = "12345678"; |
37 | 37 | private static final String TEST_PASSWD2 = "87654321"; |
38 | | - private static final String TEST_KEYNAME = "testkey"; |
39 | | - private static final String TEST_KEYNAME1 = "testkey1"; |
40 | | - private static final String TEST_KEYNAME2 = "testkey2"; |
| 38 | + private static final String TEST_KEYNAME = "test-key"; |
| 39 | + private static final String TEST_KEYNAME1 = "test-key.1"; |
| 40 | + private static final String TEST_KEYNAME2 = "test-key.2"; |
41 | 41 | private static final byte[] TEST_KEYVALUE = "test value".getBytes(Charsets.UTF_8); |
42 | 42 |
|
43 | 43 | // "Hello, World" in Chinese |
44 | 44 | private static final String TEST_I18N_KEY = "\u4F60\u597D, \u4E16\u754C"; |
45 | 45 | private static final byte[] TEST_I18N_VALUE = TEST_I18N_KEY.getBytes(Charsets.UTF_8); |
46 | 46 |
|
47 | 47 | // Test vector data for signatures |
48 | | - private static final byte[] TEST_DATA = { |
49 | | - (byte) 0x00, (byte) 0xA0, (byte) 0xFF, (byte) 0x0A, (byte) 0x00, (byte) 0xFF, |
50 | | - (byte) 0xAA, (byte) 0x55, (byte) 0x05, (byte) 0x5A, |
51 | | - }; |
| 48 | + private static final byte[] TEST_DATA = new byte[256]; |
| 49 | + static { |
| 50 | + for (int i = 0; i < TEST_DATA.length; i++) { |
| 51 | + TEST_DATA[i] = (byte) i; |
| 52 | + } |
| 53 | + } |
52 | 54 |
|
53 | 55 | private KeyStore mKeyStore = null; |
54 | 56 |
|
@@ -155,9 +157,9 @@ public void testI18n() throws Exception { |
155 | 157 | } |
156 | 158 |
|
157 | 159 | public void testDelete() throws Exception { |
158 | | - assertTrue(mKeyStore.delete(TEST_KEYNAME)); |
| 160 | + assertFalse(mKeyStore.delete(TEST_KEYNAME)); |
159 | 161 | mKeyStore.password(TEST_PASSWD); |
160 | | - assertTrue(mKeyStore.delete(TEST_KEYNAME)); |
| 162 | + assertFalse(mKeyStore.delete(TEST_KEYNAME)); |
161 | 163 |
|
162 | 164 | mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE); |
163 | 165 | assertTrue(Arrays.equals(TEST_KEYVALUE, mKeyStore.get(TEST_KEYNAME))); |
|
0 commit comments