Debian Codegraph @

tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppHomeButtonTest.kt

raw
1 /*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.android.server.wm.flicker.close
18
19 import android.platform.test.annotations.Presubmit
20 import androidx.test.filters.FlakyTest
21 import androidx.test.filters.RequiresDevice
22 import com.android.server.wm.flicker.FlickerParametersRunnerFactory
23 import com.android.server.wm.flicker.FlickerTestParameter
24 import com.android.server.wm.flicker.FlickerTestParameterFactory
25 import com.android.server.wm.flicker.annotation.Group4
26 import com.android.server.wm.flicker.dsl.FlickerBuilder
27 import org.junit.FixMethodOrder
28 import org.junit.Test
29 import org.junit.runner.RunWith
30 import org.junit.runners.MethodSorters
31 import org.junit.runners.Parameterized
32
33 /**
34 * Test app closes by pressing home button
35 *
36 * To run this test: `atest FlickerTests:CloseAppHomeButtonTest`
37 *
38 * Actions:
39 * Make sure no apps are running on the device
40 * Launch an app [testApp] and wait animation to complete
41 * Press home button
42 *
43 * To run only the presubmit assertions add: `--
44 * --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
45 * --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Presubmit`
46 *
47 * To run only the postsubmit assertions add: `--
48 * --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest
49 * --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Postsubmit`
50 *
51 * To run only the flaky assertions add: `--
52 * --module-arg FlickerTests:include-annotation:androidx.test.filters.FlakyTest`
53 *
54 * Notes:
55 * 1. Some default assertions (e.g., nav bar, status bar and screen covered)
56 * are inherited [CloseAppTransition]
57 * 2. Part of the test setup occurs automatically via
58 * [com.android.server.wm.flicker.TransitionRunnerWithRules],
59 * including configuring navigation mode, initial orientation and ensuring no
60 * apps are running before setup
61 */
62 @RequiresDevice
63 @RunWith(Parameterized::class)
64 @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
65 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
66 @Group4
67 class CloseAppHomeButtonTest(testSpec: FlickerTestParameter) : CloseAppTransition(testSpec) {
68 override val transition: FlickerBuilder.() -> Unit
69 get() = {
70 super.transition(this)
71 transitions {
72 device.pressHome()
73 wmHelper.waitForHomeActivityVisible()
74 }
75 }
76
77 /** {@inheritDoc} */
78 @FlakyTest
79 @Test
80 override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales()
81
82 /** {@inheritDoc} */
83 @FlakyTest(bugId = 227430489)
84 @Test
85 override fun statusBarLayerRotatesScales() {
86 super.statusBarLayerRotatesScales()
87 }
88
89 /** {@inheritDoc} */
90 @Presubmit
91 @Test
92 override fun launcherLayerReplacesApp() {
93 super.launcherLayerReplacesApp()
94 }
95
96 /** {@inheritDoc} */
97 @Presubmit
98 @Test
99 override fun entireScreenCovered() {
100 super.entireScreenCovered()
101 }
102
103 /** {@inheritDoc} */
104 @FlakyTest(bugId = 229762973)
105 @Test
106 override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
107 super.visibleLayersShownMoreThanOneConsecutiveEntry()
108
109 companion object {
110 /**
111 * Creates the test configurations.
112 *
113 * See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
114 * repetitions, screen orientation and navigation modes.
115 */
116 @Parameterized.Parameters(name = "{0}")
117 @JvmStatic
118 fun getParams(): Collection<FlickerTestParameter> {
119 return FlickerTestParameterFactory.getInstance()
120 .getConfigNonRotationTests(repetitions = 3)
121 }
122 }
123 }