summaryrefslogtreecommitdiff
path: root/test-runner/src/android/test/suitebuilder/TestGrouping.java
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2017-06-20 16:18:07 +0100
committerPaul Duffin <paulduffin@google.com>2017-06-26 17:00:21 +0100
commitaaaba76810c0b5b61c609a929536b64ac7e368fc (patch)
tree9dabcf4edf22526ff3a057fcd5a0bb2d0be0ae53 /test-runner/src/android/test/suitebuilder/TestGrouping.java
parent3c5ab7d3243e646137d9e60c2a54ffc907a85a27 (diff)
Clean up ClassPathPackageInfoSource
Part of the work of removing JUnit and dependent android.test classes from the Android API involves providing a static library that developers can include in their test applications to ease migration. That library will be built directly from the source (as opposed to android.jar which is built from stubs) and so developers will be able to see classes and methods that are not present in the stubs. This change is one of a number of similar changes that cleanup the existing non-API code in order to minimize the additional methods and classes exposed externally. The basic approach is to remove unused classes and methods, use least visible access modifier possible and generally minimize the amount of publicly visible code. PackageInfoSources only provided a static field and accessor method so they were moved into ClassPathPackageInfoSource and PackageInfoSources was removed. ClassPathPackageInfo was only used in ClassPathPackageInfoSource and in TestGrouping. In the latter it was simply used as an intermediate value between ClassPathPackageInfoSource.getPackage(String packageName) and ClassPathPackageInfo.getTopLevelClassesRecursive(String packageName). Moving that method into ClassPathPackageInfoSource allowed the ClassPathPackageInfo to become an inner class of ClassPathPackageInfoSource. As it is an inner class it no longer needed an explicit reference to the containing ClassPathPackageInfoSource. Bug: 30188076 Test: make checkbuild and ran FrameworkTestRunnerTests Change-Id: Idb0b6a585030805b9cff8562abb93b7e5920c53a
Diffstat (limited to 'test-runner/src/android/test/suitebuilder/TestGrouping.java')
-rw-r--r--test-runner/src/android/test/suitebuilder/TestGrouping.java7
1 files changed, 2 insertions, 5 deletions
diff --git a/test-runner/src/android/test/suitebuilder/TestGrouping.java b/test-runner/src/android/test/suitebuilder/TestGrouping.java
index 307afb55e47a..030bc426ac19 100644
--- a/test-runner/src/android/test/suitebuilder/TestGrouping.java
+++ b/test-runner/src/android/test/suitebuilder/TestGrouping.java
@@ -16,9 +16,7 @@
package android.test.suitebuilder;
-import android.test.ClassPathPackageInfo;
import android.test.ClassPathPackageInfoSource;
-import android.test.PackageInfoSources;
import android.util.Log;
import com.android.internal.util.Predicate;
import junit.framework.TestCase;
@@ -131,10 +129,9 @@ class TestGrouping {
}
private List<Class<? extends TestCase>> testCaseClassesInPackage(String packageName) {
- ClassPathPackageInfoSource source = PackageInfoSources.forClassPath(classLoader);
- ClassPathPackageInfo packageInfo = source.getPackageInfo(packageName);
+ ClassPathPackageInfoSource source = ClassPathPackageInfoSource.forClassPath(classLoader);
- return selectTestClasses(packageInfo.getTopLevelClassesRecursive());
+ return selectTestClasses(source.getTopLevelClassesRecursive(packageName));
}
@SuppressWarnings("unchecked")