Merge "Fix TEST_MAPPING file for integrity component."

This commit is contained in:
TreeHugger Robot
2020-02-14 19:07:49 +00:00
committed by Android (Google) Code Review
6 changed files with 10 additions and 67 deletions

View File

@@ -5,12 +5,6 @@
"options": [
{
"include-filter": "com.android.server.integrity."
},
{
"include-annotation": "android.platform.test.annotations.Presubmit"
},
{
"exclude-annotation": "androidx.test.filters.FlakyTest"
}
]
}

View File

@@ -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" />

View File

@@ -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

View File

@@ -1,21 +0,0 @@
// 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",
}

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Copyright (C) 2019 Google Inc.
*
* 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.google.android.appintegritymanager.test.app"
android:versionCode="5000">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="28" />
<application android:hasCode="false">
<meta-data android:name="allowed-installers" android:value="com.android.vending|play_store_cert,adb"/>
</application>
</manifest>