Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61b10ac9 authored by Brett Chabot's avatar Brett Chabot Committed by The Android Open Source Project
Browse files

AI 143870: am: CL 143869 Change InstrumentationTestRunner so all tests in the...

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
parent fb43fea6
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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)) {
+8 −7
Original line number Diff line number Diff line
@@ -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();
                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("");
                }

            if (testSuite == null) {
                testSuiteBuilder.includePackages(getTargetContext().getPackageName());
            }
        } else {
            parseTestClasses(testClassesArg, testSuiteBuilder);