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

Commit b13b17d8 authored by Jovana Knezevic's avatar Jovana Knezevic Committed by Android (Google) Code Review
Browse files

Merge "Modifying test to exclude automotive specific classes if running in non-automotive build."

parents d5bd7b5c f40566e3
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;

import android.content.pm.PackageManager;
import android.support.test.filters.LargeTest;
import android.support.test.filters.MediumTest;
import android.support.test.filters.SmallTest;
@@ -115,6 +116,13 @@ public class AAAPlusPlusVerifySysuiRequiredTestPropertiesTest extends SysuiTestC
        filter.add(new ExternalClassNameFilter());
        filter.add(s -> s.startsWith("com.android.systemui")
                || s.startsWith("com.android.keyguard"));


        if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
            // If it's not automotive target, exclude automotive classes from the test.
            excludeAutomotiveClasses(filter);
        }

        try {
            return scanner.getClassPathEntries(filter);
        } catch (IOException e) {
@@ -123,6 +131,13 @@ public class AAAPlusPlusVerifySysuiRequiredTestPropertiesTest extends SysuiTestC
        return Collections.emptyList();
    }

    private void excludeAutomotiveClasses(ChainedClassNameFilter filter) {
        // Modifies the passed in filter.
        filter.add(s -> !s.startsWith("com.android.systemui.statusbar.car."));
        filter.add(s -> !s.startsWith("com.android.systemui.qs.car."));
        filter.add(s -> !s.startsWith("com.android.systemui.car."));
    }

    private String getClsStr() {
        return TextUtils.join(",", Arrays.asList(BASE_CLS_WHITELIST)
                .stream().map(cls -> cls.getSimpleName()).toArray());