summaryrefslogtreecommitdiffstats
path: root/security/src
diff options
context:
space:
mode:
authorJorg Pleumann <>2009-04-28 10:12:13 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-04-28 10:12:13 -0700
commit998421c91bc71aa3677dd91ac4a6b106f4bd297b (patch)
tree12a5f0187b6358c0c6f7f576db5319b5f70fe507 /security/src
parent1a7e762f344c111416b001a61e41451d01f605ad (diff)
downloadlibcore-998421c91bc71aa3677dd91ac4a6b106f4bd297b.zip
libcore-998421c91bc71aa3677dd91ac4a6b106f4bd297b.tar.gz
libcore-998421c91bc71aa3677dd91ac4a6b106f4bd297b.tar.bz2
AI 147896: Some more fixes for tests that failed in
the CTS, but worked fine in run-core-tests: - One cert test needs isolation, because it destroys the security provider. - The Thread.sleep() tests were too flaky. - Tests that tried to open a temporary DEX file failed in the CTS because we do not have access to the system DEX cache. We are now simply creating our own. The Java plan in the CTS should now pass fully. Yippie! BUG=1285921 Automated import of CL 147896
Diffstat (limited to 'security/src')
-rw-r--r--security/src/test/java/tests/api/javax/security/cert/X509CertificateTest.java13
-rw-r--r--security/src/test/java/tests/security/permissions/JavaLangClassLoaderTest.java10
2 files changed, 7 insertions, 16 deletions
diff --git a/security/src/test/java/tests/api/javax/security/cert/X509CertificateTest.java b/security/src/test/java/tests/api/javax/security/cert/X509CertificateTest.java
index e12842a..4af8dc8 100644
--- a/security/src/test/java/tests/api/javax/security/cert/X509CertificateTest.java
+++ b/security/src/test/java/tests/api/javax/security/cert/X509CertificateTest.java
@@ -177,18 +177,6 @@ public class X509CertificateTest extends TestCase {
}
}
- @Override
- protected void tearDown() throws Exception {
- if (myProvider != null) {
-// Security.removeProvider(myProvider.getName());
- }
- if (mySSProvider != null) {
-// Security.removeProvider(mySSProvider.getName());
- }
-
- super.tearDown();
- }
-
/**
* X509Certificate() constructor testing.
* @tests {@link X509Certificate#X509Certificate() }
@@ -875,6 +863,7 @@ public class X509CertificateTest extends TestCase {
method = "verify",
args = {java.security.PublicKey.class, java.lang.String.class}
)
+ @SideEffect("Destroys MD5 provider, hurts succeeding tests")
public void testVerifyPublicKeyString() throws InvalidKeyException,
java.security.cert.CertificateException, NoSuchAlgorithmException,
NoSuchProviderException, SignatureException, IOException,
diff --git a/security/src/test/java/tests/security/permissions/JavaLangClassLoaderTest.java b/security/src/test/java/tests/security/permissions/JavaLangClassLoaderTest.java
index b21bece..66302ed 100644
--- a/security/src/test/java/tests/security/permissions/JavaLangClassLoaderTest.java
+++ b/security/src/test/java/tests/security/permissions/JavaLangClassLoaderTest.java
@@ -23,15 +23,16 @@ import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetNew;
import dalvik.annotation.TestTargetClass;
import dalvik.system.DexFile;
-import dalvik.system.PathClassLoader;
import junit.framework.TestCase;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
import java.security.Permission;
+import tests.support.Support_ClassLoader;
import tests.support.resource.Support_Resources;
/*
@@ -118,7 +119,7 @@ public class JavaLangClassLoaderTest extends TestCase {
args = {}
)
})
- @AndroidOnly("uses PathClassLoader and DexFile")
+ @AndroidOnly("uses DexFile")
@BrokenTest("Endless loop in ClassLoader. Actually a known failure.")
public void test_getSystemClassLoader () throws IOException,
IllegalAccessException, InstantiationException {
@@ -129,7 +130,8 @@ public class JavaLangClassLoaderTest extends TestCase {
}
@Override
public void checkPermission(Permission permission){
- if(permission instanceof RuntimePermission && "getClassLoader".equals(permission.getName())){
+ if(permission instanceof RuntimePermission &&
+ "getClassLoader".equals(permission.getName())){
called = true;
}
}
@@ -166,7 +168,7 @@ public class JavaLangClassLoaderTest extends TestCase {
InputStream is = Support_Resources.getResourceStream("testdex.jar");
Support_Resources.copyLocalFileto(tempFile, is);
DexFile dexfile = new DexFile(tempFile);
- PathClassLoader pcl = new PathClassLoader("",
+ ClassLoader pcl = Support_ClassLoader.getInstance(new URL(""),
ClassLoader.getSystemClassLoader());
Class<?> testClass = dexfile.loadClass(