Skip to content

Commit f4019af

Browse files
committed
Improve test key names to reproduce public issue
Also fixes other unrelated test failures. Bug: http://code.google.com/p/android/issues/detail?id=34577 Bug: 6837950 Change-Id: I2c5ed1cbfbe0ab6f4ddd8619696d6545be0519a8
1 parent 3889539 commit f4019af

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

keystore/tests/src/android/security/KeyStoreTest.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,22 @@
3535
public class KeyStoreTest extends ActivityUnitTestCase<Activity> {
3636
private static final String TEST_PASSWD = "12345678";
3737
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";
4141
private static final byte[] TEST_KEYVALUE = "test value".getBytes(Charsets.UTF_8);
4242

4343
// "Hello, World" in Chinese
4444
private static final String TEST_I18N_KEY = "\u4F60\u597D, \u4E16\u754C";
4545
private static final byte[] TEST_I18N_VALUE = TEST_I18N_KEY.getBytes(Charsets.UTF_8);
4646

4747
// 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+
}
5254

5355
private KeyStore mKeyStore = null;
5456

@@ -155,9 +157,9 @@ public void testI18n() throws Exception {
155157
}
156158

157159
public void testDelete() throws Exception {
158-
assertTrue(mKeyStore.delete(TEST_KEYNAME));
160+
assertFalse(mKeyStore.delete(TEST_KEYNAME));
159161
mKeyStore.password(TEST_PASSWD);
160-
assertTrue(mKeyStore.delete(TEST_KEYNAME));
162+
assertFalse(mKeyStore.delete(TEST_KEYNAME));
161163

162164
mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE);
163165
assertTrue(Arrays.equals(TEST_KEYVALUE, mKeyStore.get(TEST_KEYNAME)));

0 commit comments

Comments
 (0)