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

Commit 38cdbafa authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Fix ExtServices tests

- Switch the tests from Android.mk to Android.bp. The app itself
cannot move over yet because it uses syntax not supported by bp
- Instrument the test package instead of the package udner test
- Also fix an actual error in a test

Test: this
Change-Id: I0af081ab25630e4e911d4d9cbb60a87b2f75be90
Fixes: 123572762
parent 5e5aebe9
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
android_library {
    name: "ExtServices-core",
     srcs: [
         "src/**/*.java",
     ],
     resource_dirs: [
         "res",
     ],

     manifest: "AndroidManifest.xml",
}
 No newline at end of file
+26 −0
Original line number Original line Diff line number Diff line
android_test {
    name: "ExtServicesUnitTests",

    // Include all test java files.
    srcs: ["src/**/*.java"],

    // We only want this apk build for tests.
    certificate: "platform",

    libs: [
        "android.test.runner",
        "android.test.base",
    ],

    static_libs: [
        "ExtServices-core",
        "android-support-test",
        "mockito-target-minus-junit4",
        "espresso-core",
        "truth-prebuilt",
        "testables",
        "testng",
    ],

    platform_apis: true,
}
 No newline at end of file
+0 −26
Original line number Original line Diff line number Diff line
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

# We only want this apk build for tests.
LOCAL_MODULE_TAGS := tests
LOCAL_CERTIFICATE := platform

LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base

LOCAL_STATIC_JAVA_LIBRARIES := \
    android-support-test \
    mockito-target-minus-junit4 \
    espresso-core \
    truth-prebuilt \
    testables \
    testng

# Include all test java files.
LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_PACKAGE_NAME := ExtServicesUnitTests
LOCAL_PRIVATE_PLATFORM_APIS := true

LOCAL_INSTRUMENTATION_FOR := ExtServices

include $(BUILD_PACKAGE)
+1 −1
Original line number Original line Diff line number Diff line
@@ -24,7 +24,7 @@
    </application>
    </application>


    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
                     android:targetPackage="android.ext.services"
                     android:targetPackage="android.ext.services.tests.unit"
                     android:label="ExtServices Test Cases">
                     android:label="ExtServices Test Cases">
    </instrumentation>
    </instrumentation>


+1 −1
Original line number Original line Diff line number Diff line
@@ -180,7 +180,7 @@ public class NotificationCategorizerTest {
        assertFalse(nc.shouldSilence(NotificationCategorizer.CATEGORY_SYSTEM));
        assertFalse(nc.shouldSilence(NotificationCategorizer.CATEGORY_SYSTEM));


        when(mSbn.getUid()).thenReturn(FIRST_APPLICATION_UID);
        when(mSbn.getUid()).thenReturn(FIRST_APPLICATION_UID);
        assertEquals(NotificationCategorizer.CATEGORY_EVERYTHING_ELSE, nc.getCategory(mEntry));
        assertEquals(NotificationCategorizer.CATEGORY_HIGH, nc.getCategory(mEntry));
    }
    }


    @Test
    @Test