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