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

Commit f510906c authored by Chris Poultney's avatar Chris Poultney
Browse files

Add target for ThemePicker instrumented tests

Bug: 249505965
Test: TreeHugger, manually compiled and ran picker
Change-Id: I94db497048a849545a73c8f8314707b3277216f8
parent db18b423
Loading
Loading
Loading
Loading
+33 −12
Original line number Diff line number Diff line
@@ -27,6 +27,14 @@ filegroup {
    ],
}

filegroup {
    name: "ThemePicker_src_overrides",
    srcs: [
        "src_override/**/*.java",
        "src_override/**/*.kt",
    ],
}

filegroup {
    name: "ThemePicker_Manifest",
    srcs: [
@@ -46,11 +54,20 @@ genrule {
        + "$(location soong_zip) -o $(out) -C $$RES_DIR -D $$RES_DIR"
}

//
// Build app code.
//
android_app {
    name: "ThemePicker",
genrule {
    name: "ThemePicker_res_overrides",
    tools: ["soong_zip"],
    srcs: [
        "res_override/**/*",
    ],
    out: ["ThemePicker_res_overrides.zip"],
    cmd: "INPUTS=($(in)) && "
        + "RES_DIR=$$(dirname $$(dirname $${INPUTS[0]})) && "
        + "$(location soong_zip) -o $(out) -C $$RES_DIR -D $$RES_DIR"
}

java_defaults {
    name: "ThemePicker_defaults",

    static_libs: [
        "guava",
@@ -73,17 +90,12 @@ android_app {
    srcs: [
        ":WallpaperPicker2_srcs",
        ":ThemePicker_srcs",
        "src_override/**/*.java",
        "src_override/**/*.kt",
    ],

    resource_dirs: [
        "res_override",
        ":ThemePicker_src_overrides",
    ],

    use_embedded_native_libs: true,

    resource_zips: [":WallpaperPicker2_res", ":ThemePicker_res"],
    resource_zips: [":WallpaperPicker2_res", ":ThemePicker_res", ":ThemePicker_res_overrides"],

    optimize: {
        enabled: false,
@@ -93,6 +105,15 @@ android_app {

    privileged: true,
    system_ext_specific: true,
}

//
// Build app code.
//
android_app {
    name: "ThemePicker",
    defaults: ["ThemePicker_defaults"],

    platform_apis: true,
    manifest: "AndroidManifest.xml",
    additional_manifests: [":WallpaperPicker2_Manifest"],

tests/Android.bp

0 → 100644
+47 −0
Original line number Diff line number Diff line
// Copyright (C) 2022 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

//
// Build rule for WallpaperPicker2 tests
//
package {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

android_test {
    name: "ThemePickerTests",

    defaults: ["ThemePicker_defaults"],
    srcs: [
        "src/**/*.java",
        "src/**/*.kt",
    ],
    static_libs: [
        "WallpaperPicker2TestLib",
        "androidx.test.rules",
        "junit",
        "kotlinx_coroutines_test",
        "truth-prebuilt",
    ],
    libs: [
        "android.test.runner",
        "android.test.base",
        "android.test.mock",
    ],

    kotlincflags: ["-Xjvm-default=enable"],
    platform_apis: true,
    test_suites: ["device-tests"],
}
+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2022 The Android Open Source Project

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.wallpaper">

    <application>
        <uses-library android:name="android.test.runner" />
    </application>

    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
        android:targetPackage="com.android.wallpaper"
        android:label="Tests for ThemePicker" />

</manifest>

tests/AndroidTest.xml

0 → 100644
+28 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2022 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<configuration description="Runs Tests for ThemePicker.">
    <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
        <option name="test-file-name" value="ThemePickerTests.apk" />
    </target_preparer>

    <option name="test-suite-tag" value="apct" />
    <option name="test-tag" value="ThemePickerTests" />
    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
        <option name="package" value="com.android.wallpaper" />
        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
        <option name="hidden-api-checks" value="false"/>
    </test>
</configuration>
+2 −2
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ class KeyguardQuickAffordancePickerRepositoryTest {
                com.android.systemui.shared.quickaffordance.data.content
                    .KeyguardQuickAffordanceProviderContract
                    .FlagsTable
                    .FLAG_NAME_FEATURE_ENABLED,
                    .FLAG_NAME_CUSTOM_LOCK_SCREEN_QUICK_AFFORDANCES_ENABLED,
                true,
            )
            val values = mutableListOf<Boolean>()
@@ -90,7 +90,7 @@ class KeyguardQuickAffordancePickerRepositoryTest {
                com.android.systemui.shared.quickaffordance.data.content
                    .KeyguardQuickAffordanceProviderContract
                    .FlagsTable
                    .FLAG_NAME_FEATURE_ENABLED,
                    .FLAG_NAME_CUSTOM_LOCK_SCREEN_QUICK_AFFORDANCES_ENABLED,
                false,
            )
            val values = mutableListOf<Boolean>()