diff options
author | Brett Chabot <> | 2009-03-31 17:03:46 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-31 17:03:46 -0700 |
commit | a1d701ef2f0302ad18ff356c697466f87214a924 (patch) | |
tree | af576cdb9c3446a800b7798deb234b6a1279d63f /test-runner/android | |
parent | d65addb4c9e8d552907bc2720e6127e0259b8f09 (diff) | |
download | frameworks_base-a1d701ef2f0302ad18ff356c697466f87214a924.zip frameworks_base-a1d701ef2f0302ad18ff356c697466f87214a924.tar.gz frameworks_base-a1d701ef2f0302ad18ff356c697466f87214a924.tar.bz2 |
AI 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.
BUG=1749513
Automated import of CL 143869
Diffstat (limited to 'test-runner/android')
-rw-r--r-- | test-runner/android/test/ClassPathPackageInfoSource.java | 5 | ||||
-rw-r--r-- | test-runner/android/test/InstrumentationTestRunner.java | 15 |
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); |