blob: 61cca0d6b53f5c5733888865949d445419e35986 [file] [log] [blame]
Vishnu Nair8248b7c2018-08-01 10:13:36 -07001/*
2 * Copyright (C) 2018 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
17package com.android.server.wm.flicker;
18
19import android.platform.helpers.IAppHelper;
Vishnu Nair8248b7c2018-08-01 10:13:36 -070020import android.support.test.uiautomator.UiDevice;
21import android.util.Rational;
22import android.view.Surface;
23
Brett Chabot502ec7a2019-03-01 14:43:20 -080024import androidx.test.InstrumentationRegistry;
25import androidx.test.runner.AndroidJUnit4;
26
Vishnu Nair8248b7c2018-08-01 10:13:36 -070027import org.junit.Ignore;
28import org.junit.Test;
29import org.junit.runner.RunWith;
30
31/**
32 * Tests to help debug individual transitions, capture video recordings and create test cases.
33 */
34@Ignore("Used for debugging transitions used in FlickerTests.")
35@RunWith(AndroidJUnit4.class)
36public class DebugTest {
37 private IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
38 "com.android.server.wm.flicker.testapp", "SimpleApp");
39 private UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
40
41 /**
42 * atest FlickerTest:DebugTests#openAppCold
43 */
44 @Test
45 public void openAppCold() {
46 CommonTransitions.getOpenAppCold(testApp, uiDevice).recordAllRuns().build().run();
47 }
48
49 /**
50 * atest FlickerTest:DebugTests#openAppWarm
51 */
52 @Test
53 public void openAppWarm() {
54 CommonTransitions.openAppWarm(testApp, uiDevice).recordAllRuns().build().run();
55 }
56
57 /**
58 * atest FlickerTest:DebugTests#changeOrientationFromNaturalToLeft
59 */
60 @Test
61 public void changeOrientationFromNaturalToLeft() {
62 CommonTransitions.changeAppRotation(testApp, uiDevice, Surface.ROTATION_0,
63 Surface.ROTATION_270).recordAllRuns().build().run();
64 }
65
66 /**
67 * atest FlickerTest:DebugTests#closeAppWithBackKey
68 */
69 @Test
70 public void closeAppWithBackKey() {
71 CommonTransitions.closeAppWithBackKey(testApp, uiDevice).recordAllRuns().build().run();
72 }
73
74 /**
75 * atest FlickerTest:DebugTests#closeAppWithHomeKey
76 */
77 @Test
78 public void closeAppWithHomeKey() {
79 CommonTransitions.closeAppWithHomeKey(testApp, uiDevice).recordAllRuns().build().run();
80 }
81
82 /**
83 * atest FlickerTest:DebugTests#openAppToSplitScreen
84 */
85 @Test
86 public void openAppToSplitScreen() {
87 CommonTransitions.appToSplitScreen(testApp, uiDevice).includeJankyRuns().recordAllRuns()
88 .build().run();
89 }
90
91 /**
92 * atest FlickerTest:DebugTests#splitScreenToLauncher
93 */
94 @Test
95 public void splitScreenToLauncher() {
96 CommonTransitions.splitScreenToLauncher(testApp,
97 uiDevice).includeJankyRuns().recordAllRuns()
98 .build().run();
99 }
100
101 /**
102 * atest FlickerTest:DebugTests#resizeSplitScreen
103 */
104 @Test
105 public void resizeSplitScreen() {
106 IAppHelper bottomApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
107 "com.android.server.wm.flicker.testapp", "ImeApp");
108 CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, new Rational(1, 3),
109 new Rational(2, 3)).includeJankyRuns().recordEachRun().build().run();
110 }
111
112 // IME tests
113
114 /**
115 * atest FlickerTest:DebugTests#editTextSetFocus
116 */
117 @Test
118 public void editTextSetFocus() {
119 CommonTransitions.editTextSetFocus(uiDevice).includeJankyRuns().recordEachRun()
120 .build().run();
121 }
122
123 /**
124 * atest FlickerTest:DebugTests#editTextLoseFocusToHome
125 */
126 @Test
127 public void editTextLoseFocusToHome() {
128 CommonTransitions.editTextLoseFocusToHome(uiDevice).includeJankyRuns().recordEachRun()
129 .build().run();
130 }
131
132 /**
133 * atest FlickerTest:DebugTests#editTextLoseFocusToApp
134 */
135 @Test
136 public void editTextLoseFocusToApp() {
137 CommonTransitions.editTextLoseFocusToHome(uiDevice).includeJankyRuns().recordEachRun()
138 .build().run();
139 }
140
141 // PIP tests
142
143 /**
144 * atest FlickerTest:DebugTests#enterPipMode
145 */
146 @Test
147 public void enterPipMode() {
148 CommonTransitions.enterPipMode(uiDevice).includeJankyRuns().recordEachRun().build().run();
149 }
150
151 /**
152 * atest FlickerTest:DebugTests#exitPipModeToHome
153 */
154 @Test
155 public void exitPipModeToHome() {
156 CommonTransitions.exitPipModeToHome(uiDevice).includeJankyRuns().recordEachRun()
157 .build().run();
158 }
159
160 /**
161 * atest FlickerTest:DebugTests#exitPipModeToApp
162 */
163 @Test
164 public void exitPipModeToApp() {
165 CommonTransitions.exitPipModeToApp(uiDevice).includeJankyRuns().recordEachRun()
166 .build().run();
167 }
168}