1<?xml version="1.0" encoding="utf-8"?>
2<!--
3  ~ Copyright (C) 2023 The Android Open Source Project
4  ~
5  ~ Licensed under the Apache License, Version 2.0 (the "License");
6  ~ you may not use this file except in compliance with the License.
7  ~ You may obtain a copy of the License at
8  ~
9  ~      http://www.apache.org/licenses/LICENSE-2.0
10  ~
11  ~ Unless required by applicable law or agreed to in writing, software
12  ~ distributed under the License is distributed on an "AS IS" BASIS,
13  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  ~ See the License for the specific language governing permissions and
15  ~ limitations under the License.
16  -->
17<configuration description="Config for Cts Ad Services App Update tests in ExtServices">
18    <option name="test-suite-tag" value="cts"/>
19    <option name="test-tag" value="CtsAdExtServicesTopicsAppUpdateTests"/>
20    <option name="config-descriptor:metadata" key="component" value="framework"/>
21    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app"/>
22    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi"/>
23    <option name="config-descriptor:metadata" key="parameter" value="secondary_user"/>
24
25    <!-- Prevent test from running on Android T+ -->
26    <object type="module_controller"
27            class="com.android.tradefed.testtype.suite.module.MaxSdkModuleController">
28        <option name="max-sdk-level" value="32"/>
29    </object>
30
31    <!-- Prevent tests from running on Android R- -->
32    <object type="module_controller"
33            class="com.android.tradefed.testtype.suite.module.Sdk31ModuleController"/>
34
35    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
36        <option name="cleanup-apks" value="true"/>
37        <!-- The test apps to be installed and uninstalled -->
38        <option name="test-file-name" value="CtsAdExtServicesTopicsAppUpdateTests.apk"/>
39        <option name="check-min-sdk" value="true"/>
40    </target_preparer>
41
42    <test class="com.android.tradefed.testtype.AndroidJUnitTest">
43        <option name="hidden-api-checks" value="false"/> <!-- Allow hidden API uses -->
44        <option name="package" value="com.android.adextservices.tests.cts.topics.appupdate"/>
45    </test>
46
47    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
48        <option name="test-user-token" value="%TEST_USER%"/>
49        <!-- Create place to store tests apks that will be installed/uninstalled in the test. -->
50        <option name="run-command" value="mkdir -p /data/local/tmp/cts/install"/>
51        <option name="teardown-command" value="rm -rf /data/local/tmp/cts"/>
52        <!-- Uninstall the test app anyway in case failed test skips the uninstallation -->
53        <option name="teardown-command"
54                value="pm uninstall --user %TEST_USER% com.android.adservices.tests.cts.topics.testapp1"/>
55    </target_preparer>
56
57    <!-- Create place to store tests apks that will be installed/uninstalled in the test. -->
58    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
59        <option name="test-user-token" value="%TEST_USER%"/>
60        <option name="run-command" value="mkdir -p /data/local/tmp/cts/install"/>
61        <option name="teardown-command" value="rm -rf /data/local/tmp/cts"/>
62        <!-- Uninstall the test app anyway in case failed test skips the uninstallation -->
63        <option name="teardown-command"
64                value="pm uninstall --user %TEST_USER% com.android.adextservices.tests.cts.topics.testapp1"/>
65    </target_preparer>
66
67    <!-- Push compiled APK file of test apps to a local place for installation -->
68    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
69        <option name="push"
70                value="CtsSampleTopicsApp1.apk->/data/local/tmp/cts/install/CtsSampleTopicsApp1.apk"/>
71    </target_preparer>
72
73    <object type="module_controller"
74            class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
75        <option name="mainline-module-package-name" value="com.google.android.extservices"/>
76    </object>
77    <option name="config-descriptor:metadata" key="mainline-param"
78            value="com.google.android.extservices.apex"/>
79
80    <!-- NOTE: DeviceConfig and SystemProperties are handled by AdServicesFlagsSetterRule -->
81</configuration>
82