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

Commit 5300771c authored by Song Pan's avatar Song Pan
Browse files

Fix TEST_MAPPING file for integrity component.

Test: N/A.
Bug: 145290357
Change-Id: I7f7912cb71d62c79c4315ddd61cb49bdd8b68917
parent 71153912
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -5,12 +5,6 @@
      "options": [
        {
          "include-filter": "com.android.server.integrity."
        },
        {
          "include-annotation": "android.platform.test.annotations.Presubmit"
        },
        {
          "exclude-annotation": "androidx.test.filters.FlakyTest"
        }
      ]
    }
+0 −5
Original line number Diff line number Diff line
@@ -26,11 +26,6 @@
        <option name="test-file-name" value="SimpleServiceTestApp.apk" />
    </target_preparer>

    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
        <option name="cleanup" value="true" />
        <option name="push" value="AppIntegrityManagerServiceTestApp.apk->/data/local/tmp/AppIntegrityManagerServiceTestApp.apk" />
    </target_preparer>

    <option name="test-tag" value="FrameworksServicesTests" />
    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
        <option name="package" value="com.android.frameworks.servicestests" />
+12.3 KiB

File added.

No diff preview for this file type.

+10 −7
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ import java.util.Map;
@RunWith(JUnit4.class)
public class AppIntegrityManagerServiceImplTest {
    private static final String TEST_APP_PATH =
            "/data/local/tmp/AppIntegrityManagerServiceTestApp.apk";
            "AppIntegrityManagerServiceImplTest/AppIntegrityManagerServiceTestApp.apk";

    private static final String TEST_APP_TWO_CERT_PATH =
            "AppIntegrityManagerServiceImplTest/DummyAppTwoCerts.apk";
@@ -106,9 +106,7 @@ public class AppIntegrityManagerServiceImplTest {

    // These are obtained by running the test and checking logcat.
    private static final String APP_CERT =
            "301AA3CB081134501C45F1422ABC66C24224FD5DED5FDC8F17E697176FD866AA";
    private static final String INSTALLER_CERT =
            "301AA3CB081134501C45F1422ABC66C24224FD5DED5FDC8F17E697176FD866AA";
            "C8A2E9BCCF597C2FB6DC66BEE293FC13F2FC47EC77BC6B2B0D52C11F51192AB8";
    // We use SHA256 for package names longer than 32 characters.
    private static final String INSTALLER_SHA256 =
            "30F41A7CBF96EE736A54DD6DF759B50ED3CC126ABCEF694E167C324F5976C227";
@@ -149,8 +147,12 @@ public class AppIntegrityManagerServiceImplTest {

    @Before
    public void setup() throws Exception {
        mTestApk = new File(TEST_APP_PATH);
        mTestApkTwoCerts = File.createTempFile("AppIntegrity", ".apk");
        mTestApk = File.createTempFile("AppIntegrity", ".apk");
        try (InputStream inputStream = mRealContext.getAssets().open(TEST_APP_PATH)) {
            Files.copy(inputStream, mTestApk.toPath(), REPLACE_EXISTING);
        }

        mTestApkTwoCerts = File.createTempFile("AppIntegrityTwoCerts", ".apk");
        try (InputStream inputStream = mRealContext.getAssets().open(TEST_APP_TWO_CERT_PATH)) {
            Files.copy(inputStream, mTestApkTwoCerts.toPath(), REPLACE_EXISTING);
        }
@@ -174,6 +176,7 @@ public class AppIntegrityManagerServiceImplTest {

    @After
    public void tearDown() throws Exception {
        mTestApk.delete();
        mTestApkTwoCerts.delete();
    }

@@ -304,7 +307,7 @@ public class AppIntegrityManagerServiceImplTest {
        assertEquals(PACKAGE_NAME, appInstallMetadata.getPackageName());
        assertThat(appInstallMetadata.getAppCertificates()).containsExactly(APP_CERT);
        assertEquals(INSTALLER_SHA256, appInstallMetadata.getInstallerName());
        assertThat(appInstallMetadata.getInstallerCertificates()).containsExactly(INSTALLER_CERT);
        // we cannot check installer cert because it seems to be device specific.
        assertEquals(VERSION_CODE, appInstallMetadata.getVersionCode());
        assertFalse(appInstallMetadata.isPreInstalled());
        // These are hardcoded in the test apk android manifest
+0 −21
Original line number Diff line number Diff line
// Copyright (C) 2017 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.

android_test_helper_app {
    name: "AppIntegrityManagerServiceTestApp",

    test_suites: ["device-tests"],

    certificate: "platform",
}
Loading