summaryrefslogtreecommitdiffstats
path: root/test-runner
diff options
context:
space:
mode:
authorBrett Chabot <>2009-03-31 17:04:34 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-31 17:04:34 -0700
commit61b10ac95de29c3ff826250cf12b04b932e0cfd7 (patch)
tree0702f5b50029803905073a8a8d5cfb968b45deb1 /test-runner
parentfb43fea68a00b7b147992b52b86305f6fbc1548e (diff)
downloadframeworks_base-61b10ac95de29c3ff826250cf12b04b932e0cfd7.zip
frameworks_base-61b10ac95de29c3ff826250cf12b04b932e0cfd7.tar.gz
frameworks_base-61b10ac95de29c3ff826250cf12b04b932e0cfd7.tar.bz2
AI 143870: am: CL 143869 Change InstrumentationTestRunner so all tests in the application are run when no other arguments are supplied, instead of running only tests in the app's package.
Original author: brettchabot Merged from: //branches/cupcake/... Automated import of CL 143870
Diffstat (limited to 'test-runner')
-rw-r--r--test-runner/android/test/ClassPathPackageInfoSource.java5
-rw-r--r--test-runner/android/test/InstrumentationTestRunner.java15
2 files changed, 12 insertions, 8 deletions
diff --git a/test-runner/android/test/ClassPathPackageInfoSource.java b/test-runner/android/test/ClassPathPackageInfoSource.java
index 12bc7f3..877075f 100644
--- a/test-runner/android/test/ClassPathPackageInfoSource.java
+++ b/test-runner/android/test/ClassPathPackageInfoSource.java
@@ -226,8 +226,11 @@ public class ClassPathPackageInfoSource {
String className = apkClassNames.nextElement();
if (className.startsWith(packageName)) {
+ String subPackageName = packageName;
int lastPackageSeparator = className.lastIndexOf('.');
- String subPackageName = className.substring(0, lastPackageSeparator);
+ if (lastPackageSeparator > 0) {
+ subPackageName = className.substring(0, lastPackageSeparator);
+ }
if (subPackageName.length() > packageName.length()) {
subpackageNames.add(subPackageName);
} else if (isToplevelClass(className)) {
diff --git a/test-runner/android/test/InstrumentationTestRunner.java b/test-runner/android/test/InstrumentationTestRunner.java
index f038612..044f555 100644
--- a/test-runner/android/test/InstrumentationTestRunner.java
+++ b/test-runner/android/test/InstrumentationTestRunner.java
@@ -300,16 +300,17 @@ public class InstrumentationTestRunner extends Instrumentation implements TestSu
}
if (testClassesArg == null) {
- TestSuite testSuite = null;
if (mPackageOfTests != null) {
testSuiteBuilder.includePackages(mPackageOfTests);
} else {
- testSuite = getTestSuite();
- testSuiteBuilder.addTestSuite(testSuite);
- }
-
- if (testSuite == null) {
- testSuiteBuilder.includePackages(getTargetContext().getPackageName());
+ TestSuite testSuite = getTestSuite();
+ if (testSuite != null) {
+ testSuiteBuilder.addTestSuite(testSuite);
+ } else {
+ // no package or class bundle arguments were supplied, and no test suite
+ // provided so add all tests in application
+ testSuiteBuilder.includePackages("");
+ }
}
} else {
parseTestClasses(testClassesArg, testSuiteBuilder);