Code drop from //branches/cupcake/...@124589

This commit is contained in:
The Android Open Source Project
2008-12-17 18:04:04 -08:00
parent 5c11852110
commit e943f2fd8e
659 changed files with 47382 additions and 9976 deletions

View File

@@ -14,21 +14,19 @@
* limitations under the License.
*/
package com.android.ide.eclipse.adt.resources;
package com.android.ide.eclipse.adt.sdk;
import com.android.ide.eclipse.adt.resources.LayoutParamsParser.IClass;
import com.android.ide.eclipse.adt.sdk.IAndroidClassLoader.IClassDescriptor;
import com.android.ide.eclipse.tests.AdtTestData;
import junit.framework.TestCase;
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import junit.framework.TestCase;
/**
* Unit Test for {@link FrameworkClassLoader}.
*
@@ -51,7 +49,7 @@ public class AndroidJarLoaderTest extends TestCase {
/** Preloads classes. They should load just fine. */
public final void testPreLoadClasses() throws Exception {
mFrameworkClassLoader.preLoadClasses("jar.example.", null); //$NON-NLS-1$
mFrameworkClassLoader.preLoadClasses("jar.example.", null, null); //$NON-NLS-1$
HashMap<String, Class<?>> map = getPrivateClassCache();
assertEquals(0, map.size());
HashMap<String,byte[]> data = getPrivateEntryCache();
@@ -64,7 +62,7 @@ public class AndroidJarLoaderTest extends TestCase {
/** Preloads a class not in the JAR. Preloading does nothing in this case. */
public final void testPreLoadClasses_classNotFound() throws Exception {
mFrameworkClassLoader.preLoadClasses("not.a.package.", null); //$NON-NLS-1$
mFrameworkClassLoader.preLoadClasses("not.a.package.", null, null); //$NON-NLS-1$
HashMap<String, Class<?>> map = getPrivateClassCache();
assertEquals(0, map.size());
HashMap<String,byte[]> data = getPrivateEntryCache();
@@ -108,7 +106,7 @@ public class AndroidJarLoaderTest extends TestCase {
}
public final void testFindClassesDerivingFrom() throws Exception {
HashMap<String, ArrayList<IClass>> found =
HashMap<String, ArrayList<IClassDescriptor>> found =
mFrameworkClassLoader.findClassesDerivingFrom("jar.example.", new String[] { //$NON-NLS-1$
"jar.example.Class1", //$NON-NLS-1$
"jar.example.Class2" }); //$NON-NLS-1$

View File

@@ -14,10 +14,10 @@
* limitations under the License.
*/
package com.android.ide.eclipse.adt.resources;
package com.android.ide.eclipse.adt.sdk;
import com.android.ide.eclipse.adt.resources.AndroidJarLoader.ClassWrapper;
import com.android.ide.eclipse.adt.resources.LayoutParamsParser.IClass;
import com.android.ide.eclipse.adt.sdk.AndroidJarLoader.ClassWrapper;
import com.android.ide.eclipse.adt.sdk.IAndroidClassLoader.IClassDescriptor;
import com.android.ide.eclipse.common.resources.AttrsXmlParser;
import com.android.ide.eclipse.common.resources.ViewClassInfo;
import com.android.ide.eclipse.common.resources.ViewClassInfo.LayoutParamsInfo;
@@ -32,7 +32,7 @@ import java.util.TreeMap;
import junit.framework.TestCase;
/**
* Test the inner private methods of FrameworkResourceParser.
* Test the inner private methods of PlatformDataParser.
*
* Convention: method names that start with an underscore are actually local wrappers
* that call private methods from {@link FrameworkResourceParser} using reflection.
@@ -47,9 +47,9 @@ public class LayoutParamsParserTest extends TestCase {
}
@Override
public HashMap<String, ArrayList<IClass>> findClassesDerivingFrom(
public HashMap<String, ArrayList<IClassDescriptor>> findClassesDerivingFrom(
String rootPackage, String[] superClasses) throws ClassFormatError {
return new HashMap<String, ArrayList<IClass>>();
return new HashMap<String, ArrayList<IClassDescriptor>>();
}
}
@@ -70,8 +70,8 @@ public class LayoutParamsParserTest extends TestCase {
mTopGroupClass = new ClassWrapper(mock_android.view.ViewGroup.class);
mTopLayoutParamsClass = new ClassWrapper(mock_android.view.ViewGroup.LayoutParams.class);
mViewList = new ArrayList<IClass>();
mGroupList = new ArrayList<IClass>();
mViewList = new ArrayList<IClassDescriptor>();
mGroupList = new ArrayList<IClassDescriptor>();
mViewMap = new TreeMap<String, ExtViewClassInfo>();
mGroupMap = new TreeMap<String, ExtViewClassInfo>();
mLayoutParamsMap = new HashMap<String, LayoutParamsInfo>();
@@ -131,16 +131,16 @@ public class LayoutParamsParserTest extends TestCase {
//---- access to private methods
/** Calls the private constructor of the parser */
private FrameworkResourceParser _Constructor(String osJarPath) throws Exception {
Constructor<FrameworkResourceParser> constructor =
FrameworkResourceParser.class.getDeclaredConstructor(String.class);
private AndroidTargetParser _Constructor(String osJarPath) throws Exception {
Constructor<AndroidTargetParser> constructor =
AndroidTargetParser.class.getDeclaredConstructor(String.class);
constructor.setAccessible(true);
return constructor.newInstance(osJarPath);
}
/** calls the private getLayoutClasses() of the parser */
private void _getLayoutClasses() throws Exception {
Method method = FrameworkResourceParser.class.getDeclaredMethod("getLayoutClasses"); //$NON-NLS-1$
Method method = AndroidTargetParser.class.getDeclaredMethod("getLayoutClasses"); //$NON-NLS-1$
method.setAccessible(true);
method.invoke(mParser);
}
@@ -148,7 +148,7 @@ public class LayoutParamsParserTest extends TestCase {
/** calls the private addGroup() of the parser */
private ViewClassInfo _addGroup(Class<?> groupClass) throws Exception {
Method method = LayoutParamsParser.class.getDeclaredMethod("addGroup", //$NON-NLS-1$
IClass.class);
IClassDescriptor.class);
method.setAccessible(true);
return (ViewClassInfo) method.invoke(mParser, new ClassWrapper(groupClass));
}
@@ -156,7 +156,7 @@ public class LayoutParamsParserTest extends TestCase {
/** calls the private addLayoutParams() of the parser */
private LayoutParamsInfo _addLayoutParams(Class<?> groupClass) throws Exception {
Method method = LayoutParamsParser.class.getDeclaredMethod("addLayoutParams", //$NON-NLS-1$
IClass.class);
IClassDescriptor.class);
method.setAccessible(true);
return (LayoutParamsInfo) method.invoke(mParser, new ClassWrapper(groupClass));
}
@@ -164,17 +164,17 @@ public class LayoutParamsParserTest extends TestCase {
/** calls the private getLayoutParamsInfo() of the parser */
private LayoutParamsInfo _getLayoutParamsInfo(Class<?> layoutParamsClass) throws Exception {
Method method = LayoutParamsParser.class.getDeclaredMethod("getLayoutParamsInfo", //$NON-NLS-1$
IClass.class);
IClassDescriptor.class);
method.setAccessible(true);
return (LayoutParamsInfo) method.invoke(mParser, new ClassWrapper(layoutParamsClass));
}
/** calls the private findLayoutParams() of the parser */
private IClass _findLayoutParams(Class<?> groupClass) throws Exception {
private IClassDescriptor _findLayoutParams(Class<?> groupClass) throws Exception {
Method method = LayoutParamsParser.class.getDeclaredMethod("findLayoutParams", //$NON-NLS-1$
IClass.class);
IClassDescriptor.class);
method.setAccessible(true);
return (IClass) method.invoke(mParser, new ClassWrapper(groupClass));
return (IClassDescriptor) method.invoke(mParser, new ClassWrapper(groupClass));
}
}

View File

@@ -216,9 +216,6 @@ public class UiElementPullParserTest extends TestCase {
} catch (XmlPullParserException e) {
e.printStackTrace();
assertTrue(false);
} catch (IOException e) {
e.printStackTrace();
assertTrue(false);
}
}