Debian Codegraph @

tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppColdTest.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 androidx.test.filters.FlakyTest
20 import android.platform.test.annotations.Presubmit
21 import android.platform.test.annotations.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.Group1
26 import com.android.server.wm.flicker.dsl.FlickerBuilder
27 import com.android.server.wm.flicker.helpers.setRotation
28 import com.android.server.wm.flicker.rules.RemoveAllTasksButHomeRule.Companion.removeAllTasksButHome
29 import org.junit.FixMethodOrder
30 import org.junit.Test
31 import org.junit.runner.RunWith
32 import org.junit.runners.MethodSorters
33 import org.junit.runners.Parameterized
34
35 /**
36 * Test cold launching an app from launcher
37 *
38 * To run this test: `atest FlickerTests:OpenAppColdTest`
39 *
40 * Actions:
41 * Make sure no apps are running on the device
42 * Launch an app [testApp] and wait animation to complete
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 OpenAppColdTest(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 eachRun {
67 removeAllTasksButHome()
68 this.setRotation(testSpec.startRotation)
69 }
70 }
71 teardown {
72 eachRun {
73 testApp.exit(wmHelper)
74 }
75 }
76 transitions {
77 testApp.launchViaIntent(wmHelper)
78 wmHelper.waitForFullScreenApp(testApp.component)
79 }
80 }
81
82 /** {@inheritDoc} */
83 @FlakyTest(bugId = 206753786)
84 @Test
85 override fun statusBarLayerRotatesScales() = super.statusBarLayerRotatesScales()
86
87 /** {@inheritDoc} */
88 @FlakyTest
89 @Test
90 override fun navBarLayerRotatesAndScales() {
91 super.navBarLayerRotatesAndScales()
92 }
93
94 /** {@inheritDoc} */
95 @Presubmit
96 @Test
97 override fun appLayerReplacesLauncher() = super.appLayerReplacesLauncher()
98
99 /** {@inheritDoc} */
100 @Presubmit
101 @Test
102 override fun appWindowReplacesLauncherAsTopWindow() =
103 super.appWindowReplacesLauncherAsTopWindow()
104
105 /** {@inheritDoc} */
106 @Presubmit
107 @Test
108 override fun navBarLayerIsVisible() = super.navBarLayerIsVisible()
109
110 /** {@inheritDoc} */
111 @Presubmit
112 @Test
113 override fun navBarWindowIsVisible() = super.navBarWindowIsVisible()
114
115 /** {@inheritDoc} */
116 @Presubmit
117 @Test
118 override fun entireScreenCovered() = super.entireScreenCovered()
119
120 companion object {
121 /**
122 * Creates the test configurations.
123 *
124 * See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
125 * repetitions, screen orientation and navigation modes.
126 */
127 @Parameterized.Parameters(name = "{0}")
128 @JvmStatic
129 fun getParams(): Collection<FlickerTestParameter> {
130 return FlickerTestParameterFactory.getInstance()
131 .getConfigNonRotationTests()
132 }
133 }
134 }