diff options
author | Neil Fuller <nfuller@google.com> | 2014-06-18 16:51:12 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-06-17 21:55:36 +0000 |
commit | 67875c4ab6941278e57e6c1d05156703b55be6ef (patch) | |
tree | 51393a374e75433d42f3d85f3ddb6f3b7d1b96c8 /luni/src/test | |
parent | 36c0160226be643a0dcc98a25dc5543909555764 (diff) | |
parent | 11d630b19f9f3f7db427823b347aff09ab4cfb69 (diff) | |
download | libcore-67875c4ab6941278e57e6c1d05156703b55be6ef.zip libcore-67875c4ab6941278e57e6c1d05156703b55be6ef.tar.gz libcore-67875c4ab6941278e57e6c1d05156703b55be6ef.tar.bz2 |
Merge "Relax KeyPairGeneratorTest"
Diffstat (limited to 'luni/src/test')
-rw-r--r-- | luni/src/test/java/libcore/java/security/KeyPairGeneratorTest.java | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/luni/src/test/java/libcore/java/security/KeyPairGeneratorTest.java b/luni/src/test/java/libcore/java/security/KeyPairGeneratorTest.java index 55e088f..09a18e2 100644 --- a/luni/src/test/java/libcore/java/security/KeyPairGeneratorTest.java +++ b/luni/src/test/java/libcore/java/security/KeyPairGeneratorTest.java @@ -54,28 +54,63 @@ import junit.framework.TestCase; public class KeyPairGeneratorTest extends TestCase { public void test_providerCount() { - // If this fails remember to add/remove _provider methods below. This test is sharded - // because it takes so long. - assertEquals(4, Security.getProviders().length); + Provider[] providers = Security.getProviders(); + // We expect there to be at least one provider. + assertTrue(providers.length > 0); + // If this fails remember to add _provider methods below. This test is sharded because it + // takes a long time to execute. + assertTrue(providers.length < 10); } public void test_getInstance_provider0() throws Exception { - test_getInstance(Security.getProviders()[0]); + test_getInstance(0); } public void test_getInstance_provider1() throws Exception { - test_getInstance(Security.getProviders()[1]); + test_getInstance(1); } public void test_getInstance_provider2() throws Exception { - test_getInstance(Security.getProviders()[2]); + test_getInstance(2); } public void test_getInstance_provider3() throws Exception { - test_getInstance(Security.getProviders()[3]); + test_getInstance(3); + } + + public void test_getInstance_provider4() throws Exception { + test_getInstance(4); + } + + public void test_getInstance_provider5() throws Exception { + test_getInstance(5); + } + + public void test_getInstance_provider6() throws Exception { + test_getInstance(6); } - private void test_getInstance(Provider provider) throws Exception { + public void test_getInstance_provider7() throws Exception { + test_getInstance(7); + } + + public void test_getInstance_provider8() throws Exception { + test_getInstance(8); + } + + public void test_getInstance_provider9() throws Exception { + test_getInstance(9); + } + + private void test_getInstance(int providerIndex) throws Exception { + Provider[] providers = Security.getProviders(); + if (providerIndex >= providers.length) { + // Providers can be added by vendors and other tests. We do not + // specify a fixed number and silenty pass if the provider at the + // specified index does not exist. + return; + } + Provider provider = providers[providerIndex]; Set<Provider.Service> services = provider.getServices(); for (Provider.Service service : services) { String type = service.getType(); |