Debian Codegraph @

tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationCold.kt

raw
1 /*
2 * Copyright (C) 2022 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.Postsubmit
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 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 cold launching an app from a notification from the lock screen.
35 *
36 * This test assumes the device doesn't have AOD enabled
37 *
38 * To run this test: `atest FlickerTests:OpenAppFromLockNotificationCold`
39 */
40 @RequiresDevice
41 @RunWith(Parameterized::class)
42 @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
43 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
44 @Group1
45 @Postsubmit
46 open class OpenAppFromLockNotificationCold(testSpec: FlickerTestParameter)
47 : OpenAppFromNotificationCold(testSpec) {
48
49 override val openingNotificationsFromLockScreen = true
50
51 override val transition: FlickerBuilder.() -> Unit
52 get() = {
53 // Needs to run at start of transition,
54 // so before the transition defined in super.transition
55 transitions {
56 device.wakeUp()
57 }
58
59 super.transition(this)
60
61 // Needs to run at the end of the setup, so after the setup defined in super.transition
62 setup {
63 eachRun {
64 device.sleep()
65 wmHelper.waitFor("noAppWindowsOnTop") {
66 it.wmState.topVisibleAppWindow.isEmpty()
67 }
68 }
69 }
70 }
71
72 /** {@inheritDoc} */
73 @FlakyTest(bugId = 229735718)
74 @Test
75 override fun entireScreenCovered() = super.entireScreenCovered()
76
77 /** {@inheritDoc} */
78 @FlakyTest(bugId = 203538234)
79 @Test
80 override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
81 super.visibleWindowsShownMoreThanOneConsecutiveEntry()
82
83 /** {@inheritDoc} */
84 @FlakyTest(bugId = 203538234)
85 @Test
86 override fun appWindowBecomesTopWindow() = super.appWindowBecomesTopWindow()
87
88 companion object {
89 /**
90 * Creates the test configurations.
91 *
92 * See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring
93 * repetitions, screen orientation and navigation modes.
94 */
95 @Parameterized.Parameters(name = "{0}")
96 @JvmStatic
97 fun getParams(): Collection<FlickerTestParameter> {
98 return com.android.server.wm.flicker.FlickerTestParameterFactory.getInstance()
99 .getConfigNonRotationTests(repetitions = 3)
100 }
101 }
102 }