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

Commit 4554e74a authored by Yi-an Chen's avatar Yi-an Chen
Browse files

Add unit tests for AppIdPermissionPolicy

Bug: 280853174
Test: AppIdPermissionPolicyTest

Change-Id: I67c3c86b2ca4c0a87b05922f3a7fcc3bff04123d
parent 623d18cf
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -17,8 +17,8 @@ filegroup {
    visibility: ["//frameworks/base/services"],
}

java_library_static {
    name: "services.permission",
java_library {
    name: "services.permission-pre-jarjar",
    defaults: ["platform_service_defaults"],
    srcs: [":services.permission-sources"],
    libs: [
@@ -32,7 +32,6 @@ java_library_static {
        // Adds reflection-less suppressed exceptions and AutoCloseable.use().
        "kotlin-stdlib-jdk7",
    ],
    jarjar_rules: "jarjar-rules.txt",
    kotlincflags: [
        "-Xjvm-default=all",
        "-Xno-call-assertions",
@@ -40,3 +39,9 @@ java_library_static {
        "-Xno-receiver-assertions",
    ],
}

java_library {
    name: "services.permission",
    static_libs: ["services.permission-pre-jarjar"],
    jarjar_rules: "jarjar-rules.txt",
}
+44 −0
Original line number Diff line number Diff line
// Copyright (C) 2023 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.

package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "frameworks_base_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["frameworks_base_license"],
}

android_test {
    name: "PermissionServiceMockingTests",
    defaults: [
        // This is needed for the ExtendedMockitoRule
        "modules-utils-testable-device-config-defaults",
    ],
    srcs: [
        "src/**/*.kt",
    ],
    static_libs: [
        "mockingservicestests-utils-mockito",
        "services.core",
        "services.permission-pre-jarjar",
        "servicestests-core-utils",
        "servicestests-utils",
    ],
    platform_apis: true,
    test_suites: [
        "device-tests",
    ],
}
+32 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<!--
     Copyright (C) 2023 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.server.permission.test">

    <application android:debuggable="true">
        <uses-library android:name="android.test.mock" android:required="true" />
        <uses-library android:name="android.test.runner" />
    </application>

    <instrumentation
        android:name="androidx.test.runner.AndroidJUnitRunner"
        android:targetPackage="com.android.server.permission.test"
        android:label="Permission Service Mocking Tests" />
</manifest>
+29 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<!-- Copyright (C) 2023 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="Configuration for PermissionServiceMockingTests">
    <option name="test-tag" value="PermissionServiceMockingTests" />

    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
        <option name="cleanup-apks" value="true" />
        <option name="test-file-name" value="PermissionServiceMockingTests.apk" />
    </target_preparer>

    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
        <option name="package" value="com.android.server.permission.test" />
        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
    </test>
</configuration>
+1 −0
Original line number Diff line number Diff line
include platform/frameworks/base:/core/java/android/permission/OWNERS
Loading