blob: 6792a8b486afa584c2f1fdde97d384a139ba1c48 [file] [log] [blame]
Yury Khmel4f26c042015-09-02 17:39:14 +09001/*
2 * Copyright (C) 2015 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 android.windowanimationjank;
18
19import android.os.Bundle;
Brett Chabot502ec7a2019-03-01 14:43:20 -080020
21import androidx.test.jank.GfxMonitor;
22import androidx.test.jank.JankTest;
Yury Khmel4f26c042015-09-02 17:39:14 +090023
24/**
25 * Detect janks during screen rotation for full-screen activity. Periodically change
26 * orientation from left to right and track ElementLayoutActivity rendering performance
27 * via GfxMonitor.
28 */
29public class FullscreenRotationTest extends WindowAnimationJankTestBase {
30 private final static int STEP_CNT = 3;
31
32 @Override
33 public void beforeTest() throws Exception {
34 getUiDevice().setOrientationLeft();
35 Utils.startElementLayout(getInstrumentation(), 100);
36 super.beforeTest();
37 }
38
39 @Override
40 public void afterTest(Bundle metrics) {
41 Utils.rotateDevice(getInstrumentation(), Utils.ROTATION_MODE_NATURAL);
42 super.afterTest(metrics);
43 }
44
45 @JankTest(expectedFrames=100, defaultIterationCount=2)
46 @GfxMonitor(processName=Utils.PACKAGE)
47 public void testRotation() throws Exception {
48 for (int i = 0; i < STEP_CNT; ++i) {
49 Utils.rotateDevice(getInstrumentation(),
50 Utils.getDeviceRotation(getInstrumentation()) == Utils.ROTATION_MODE_LEFT ?
51 Utils.ROTATION_MODE_RIGHT : Utils.ROTATION_MODE_LEFT);
52 }
53 }
54}