summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2023-03-24 18:09:52 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2023-03-24 18:09:52 +0000
commit6c188b7bbf1f83f8c891e65dc42f4f8ccd8f20a0 (patch)
tree46ab66add498612786f9f8e1032ab2d265b3acc9
parent463594350709268966ad94aabafa34be4c53b360 (diff)
parentc9d55d69a6750d289db16dfbe74505d16969d4c3 (diff)
downloadPermission-6c188b7bbf1f83f8c891e65dc42f4f8ccd8f20a0.tar.gz
Merge "Split SafetyCenterFunctionalTestCases into multiple modules" into udc-dev
-rw-r--r--SafetyCenter/TEST_MAPPING3
-rw-r--r--tests/functional/safetycenter/safetycenteractivity/Android.bp42
-rw-r--r--tests/functional/safetycenter/safetycenteractivity/AndroidManifest.xml29
-rw-r--r--tests/functional/safetycenter/safetycenteractivity/AndroidTest.xml57
-rw-r--r--tests/functional/safetycenter/safetycenteractivity/TEST_MAPPING17
-rw-r--r--tests/functional/safetycenter/safetycenteractivity/src/android/safetycenter/functional/ui/SafetyCenterActivityTest.kt (renamed from tests/functional/safetycenter/singleuser/src/android/safetycenter/functional/ui/SafetyCenterActivityTest.kt)24
6 files changed, 166 insertions, 6 deletions
diff --git a/SafetyCenter/TEST_MAPPING b/SafetyCenter/TEST_MAPPING
index 6f3b5201b..5bc6abbc7 100644
--- a/SafetyCenter/TEST_MAPPING
+++ b/SafetyCenter/TEST_MAPPING
@@ -7,6 +7,9 @@
"path": "packages/modules/Permission/tests/functional/safetycenter/multiusers/"
},
{
+ "path": "packages/modules/Permission/tests/functional/safetycenter/safetycenteractivity/"
+ },
+ {
"path": "packages/modules/Permission/tests/functional/safetycenter/singleuser/"
}
]
diff --git a/tests/functional/safetycenter/safetycenteractivity/Android.bp b/tests/functional/safetycenter/safetycenteractivity/Android.bp
new file mode 100644
index 000000000..48f69d541
--- /dev/null
+++ b/tests/functional/safetycenter/safetycenteractivity/Android.bp
@@ -0,0 +1,42 @@
+//
+// 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 {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+android_test {
+ name: "SafetyCenterActivityFunctionalTestCases",
+ defaults: ["mts-target-sdk-version-current"],
+ sdk_version: "test_current",
+ min_sdk_version: "30",
+ srcs: [
+ "src/**/*.java",
+ "src/**/*.kt",
+ ],
+ static_libs: [
+ "androidx.test.rules",
+ "androidx.test.ext.junit",
+ "compatibility-device-preconditions",
+ "kotlin-test",
+ "safety-center-test-util-lib",
+ "safety-center-pending-intents",
+ ],
+ test_suites: [
+ "general-tests",
+ "mts-permission",
+ ],
+}
diff --git a/tests/functional/safetycenter/safetycenteractivity/AndroidManifest.xml b/tests/functional/safetycenter/safetycenteractivity/AndroidManifest.xml
new file mode 100644
index 000000000..c08ae78b0
--- /dev/null
+++ b/tests/functional/safetycenter/safetycenteractivity/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?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="android.safetycenter.functional.ui.safetycenteractivity">
+ <application>
+ <uses-library android:name="android.test.runner"/>
+ </application>
+
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="Functional tests for SafetyCenterActivity"
+ android:targetPackage="android.safetycenter.functional.ui.safetycenteractivity"/>
+
+ <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
+ <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
+</manifest>
diff --git a/tests/functional/safetycenter/safetycenteractivity/AndroidTest.xml b/tests/functional/safetycenter/safetycenteractivity/AndroidTest.xml
new file mode 100644
index 000000000..090e1f90b
--- /dev/null
+++ b/tests/functional/safetycenter/safetycenteractivity/AndroidTest.xml
@@ -0,0 +1,57 @@
+<?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="Config for functional SafetyCenterActivity test cases">
+
+ <object
+ class="com.android.tradefed.testtype.suite.module.Sdk33ModuleController"
+ type="module_controller"/>
+
+ <option name="config-descriptor:metadata" key="component" value="framework"/>
+ <option name="config-descriptor:metadata" key="parameter"
+ value="not_instant_app"/>
+ <option name="config-descriptor:metadata" key="parameter"
+ value="not_multi_abi"/>
+ <!-- Multi-user code is tested separately using Bedstead. See SafetyCenterMultiUsersTest. -->
+ <option name="config-descriptor:metadata" key="parameter"
+ value="not_secondary_user"/>
+ <option name="config-descriptor:metadata" key="mainline-param" value="com.google.android.permission.apex" />
+ <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
+
+ <option name="test-suite-tag" value="functional"/>
+
+ <target_preparer
+ class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true"/>
+ <option name="test-file-name" value="SafetyCenterActivityFunctionalTestCases.apk"/>
+ </target_preparer>
+
+ <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
+ <!-- Ensure all broadcasts are dispatched prior to running our tests, to make sure they
+ aren't polluted by `BOOT_COMPLETED` or similar broadcasts still being delivered, which
+ causes our `ActivityManager#waitForBroadcastIdle()` calls to timeout. -->
+ <option name="run-command" value="am wait-for-broadcast-idle" />
+ <!-- Disable syncing to prevent overwriting flags during testing. -->
+ <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" />
+ <option name="teardown-command" value="device_config set_sync_disabled_for_tests none" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest">
+ <option name="package" value="android.safetycenter.functional.ui.safetycenteractivity"/>
+ <option name="exclude-annotation" value="org.junit.Ignore"/>
+ <option name="runtime-hint" value="10m"/>
+ </test>
+</configuration>
diff --git a/tests/functional/safetycenter/safetycenteractivity/TEST_MAPPING b/tests/functional/safetycenter/safetycenteractivity/TEST_MAPPING
new file mode 100644
index 000000000..533b4d2a5
--- /dev/null
+++ b/tests/functional/safetycenter/safetycenteractivity/TEST_MAPPING
@@ -0,0 +1,17 @@
+{
+ "presubmit": [
+ {
+ "name": "SafetyCenterActivityFunctionalTestCases"
+ }
+ ],
+ "mainline-presubmit": [
+ {
+ "name": "SafetyCenterActivityFunctionalTestCases[com.google.android.permission.apex]",
+ "options": [
+ {
+ "exclude-annotation": "android.platform.test.annotations.FlakyTest"
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/functional/safetycenter/singleuser/src/android/safetycenter/functional/ui/SafetyCenterActivityTest.kt b/tests/functional/safetycenter/safetycenteractivity/src/android/safetycenter/functional/ui/SafetyCenterActivityTest.kt
index 10ef9cf52..1b3054403 100644
--- a/tests/functional/safetycenter/singleuser/src/android/safetycenter/functional/ui/SafetyCenterActivityTest.kt
+++ b/tests/functional/safetycenter/safetycenteractivity/src/android/safetycenter/functional/ui/SafetyCenterActivityTest.kt
@@ -515,7 +515,9 @@ class SafetyCenterActivityTest {
context.launchSafetyCenterActivity {
waitDisplayed(
By.text(context.getString(safetyCenterTestConfigs.staticSource1.titleResId))
- ) { it.click() }
+ ) {
+ it.click()
+ }
waitButtonDisplayed("Exit test activity") { it.click() }
waitAllTextDisplayed(
context.getString(safetyCenterTestConfigs.staticSource1.titleResId)
@@ -1237,7 +1239,9 @@ class SafetyCenterActivityTest {
context.launchSafetyCenterActivity {
waitDisplayed(
By.text(context.getString(safetyCenterTestConfigs.dynamicSourceGroup1.titleResId))
- ) { it.click() }
+ ) {
+ it.click()
+ }
waitAllTextNotDisplayed(
context.getString(safetyCenterTestConfigs.dynamicSourceGroup1.summaryResId)
@@ -1305,11 +1309,15 @@ class SafetyCenterActivityTest {
context.launchSafetyCenterActivity {
waitDisplayed(
By.text(context.getString(safetyCenterTestConfigs.dynamicSourceGroup1.titleResId))
- ) { it.click() }
+ ) {
+ it.click()
+ }
waitDisplayed(
By.text(context.getString(safetyCenterTestConfigs.dynamicSourceGroup1.titleResId))
- ) { it.click() }
+ ) {
+ it.click()
+ }
waitAllTextDisplayed(
context.getString(safetyCenterTestConfigs.dynamicSourceGroup1.titleResId)
@@ -1325,7 +1333,9 @@ class SafetyCenterActivityTest {
context.launchSafetyCenterActivity {
waitDisplayed(
By.text(context.getString(safetyCenterTestConfigs.dynamicSourceGroup1.titleResId))
- ) { it.click() }
+ ) {
+ it.click()
+ }
getUiDevice().rotate()
@@ -1394,7 +1404,9 @@ class SafetyCenterActivityTest {
context.launchSafetyCenterActivity {
waitDisplayed(
By.text(context.getString(safetyCenterTestConfigs.dynamicSourceGroup1.titleResId))
- ) { it.click() }
+ ) {
+ it.click()
+ }
waitAllTextNotDisplayed(
context.getString(safetyCenterTestConfigs.dynamicSourceGroup1.summaryResId)