Debian Codegraph @

tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppWarmTest.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.launch
18
19 import android.platform.test.annotations.Presubmit
20 import android.platform.test.annotations.RequiresDevice
21 import androidx.test.filters.FlakyTest
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.Group1
26 import com.android.server.wm.flicker.dsl.FlickerBuilder
27 import com.android.server.wm.flicker.helpers.setRotation
28 import org.junit.FixMethodOrder
29 import org.junit.Test
30 import org.junit.runner.RunWith
31 import org.junit.runners.MethodSorters
32 import org.junit.runners.Parameterized
33
34 /**
35 * Test warm launching an app from launcher
36 *
37 * To run this test: `atest FlickerTests:OpenAppWarmTest`
38 *
39 * Actions:
40 * Launch [testApp]
41 * Press home
42 * Relaunch an app [testApp] and wait animation to complete (only this action is traced)
43 *
44 * Notes:
45 * 1. Some default assertions (e.g., nav bar, status bar and screen covered)
46 * are inherited [OpenAppTransition]
47 * 2. Part of the test setup occurs automatically via
48 * [com.android.server.wm.flicker.TransitionRunnerWithRules],
49 * including configuring navigation mode, initial orientation and ensuring no
50 * apps are running before setup
51 */
52 @RequiresDevice
53 @RunWith(Parameterized::class)
54 @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
55 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
56 @Group1
57 open class OpenAppWarmTest(testSpec: FlickerTestParameter)
58 : OpenAppFromLauncherTransition(testSpec) {
59 /**
60 * Defines the transition used to run the test
61 */
62 override val transition: FlickerBuilder.() -> Unit
63 get() = {
64 super.transition(this)
65 setup {
66 test {
67 testApp.launchViaIntent(wmHelper)
68 }
69 eachRun {
70 device.pressHome()
71 wmHelper.waitForHomeActivityVisible()
72 this.setRotation(testSpec.startRotation)
73 }
74 }
75 teardown {
76 eachRun {
77 testApp.exit(wmHelper)
78 }
79 }
80 transitions {
81 testApp.launchViaIntent(wmHelper)
82 wmHelper.waitForFullScreenApp(testApp.component)
83 }
84 }
85
86 /** {@inheritDoc} */
87 @FlakyTest(bugId = 206753786)
88 @Test
89 override fun statusBarLayerRotatesScales() = super.statusBarLayerRotatesScales()
90
91 /** {@inheritDoc} */
92 @Presubmit
93 @Test
94 override fun appWindowReplacesLauncherAsTopWindow() =
95 super.appWindowReplacesLauncherAsTopWindow()
96
97 /** {@inheritDoc} */
98 @Presubmit
99 @Test
100 override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
101 super.visibleLayersShownMoreThanOneConsecutiveEntry()
102
103 /** {@inheritDoc} */
104 @FlakyTest
105 @Test
106 override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales()
107
108 /** {@inheritDoc} */
109 @Presubmit
110 @Test
111 override fun appLayerReplacesLauncher() = super.appLayerReplacesLauncher()
112
113 /** {@inheritDoc} */
114 @Presubmit
115 @Test
116 override fun navBarLayerIsVisible() = super.navBarLayerIsVisible()
117
118 /** {@inheritDoc} */
119 @Presubmit
120 @Test
121 override fun navBarWindowIsVisible() = super.navBarWindowIsVisible()
122
123 /** {@inheritDoc} */
124 @Presubmit
125 @Test
126 override fun appLayerBecomesVisible() = super.appLayerBecomesVisible_warmStart()
127
128 /** {@inheritDoc} */
129 @Presubmit
130 @Test
131 override fun appWindowBecomesVisible() = super.appWindowBecomesVisible_warmStart()
132
133 @FlakyTest(bugId = 229735718)
134 @Test
135 override fun entireScreenCovered() = super.entireScreenCovered()
136
137 companion object {
138 /**
139 * Creates the test configurations.
140 *
141 * See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
142 * repetitions, screen orientation and navigation modes.
143 */
144 @Parameterized.Parameters(name = "{0}")
145 @JvmStatic
146 fun getParams(): Collection<FlickerTestParameter> {
147 return FlickerTestParameterFactory.getInstance()
148 .getConfigNonRotationTests()
149 }
150 }
151 }