1 /* 2 * Copyright (C) 2023 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 android.tools.flicker.legacy 18 19 import android.app.Instrumentation 20 import android.tools.traces.monitors.ITransitionMonitor 21 import android.tools.traces.parsers.WindowManagerStateHelper 22 import android.tools.traces.surfaceflinger.LayersTrace 23 import android.tools.traces.wm.WindowManagerTrace 24 import androidx.test.uiautomator.UiDevice 25 import java.io.File 26 import org.junit.rules.TestRule 27 28 /** 29 * Defines the runner for the flicker tests. This component is responsible for running the flicker 30 * tests and executing assertions on the traces to check for inconsistent behaviors on 31 * [WindowManagerTrace] and [LayersTrace] 32 */ 33 @FlickerDslMarker 34 open class FlickerTestDataImpl( 35 /** Instrumentation to run the tests */ 36 override val instrumentation: Instrumentation, 37 /** Test automation component used to interact with the device */ 38 override val device: UiDevice, 39 /** Output directory for test results */ 40 override val outputDir: File, 41 /** Enabled tracing monitors */ 42 override val traceMonitors: List<ITransitionMonitor>, 43 /** Commands to be executed before the transition */ 44 override val transitionSetup: List<FlickerTestData.() -> Any>, 45 /** Test commands */ 46 override val transitions: List<FlickerTestData.() -> Any>, 47 /** Commands to be executed after the transition */ 48 override val transitionTeardown: List<FlickerTestData.() -> Any>, 49 /** JUnit rules to be executed around transition */ 50 override val rules: List<TestRule>, 51 /** Helper object for WM Synchronization */ 52 override val wmHelper: WindowManagerStateHelper, 53 ) : AbstractFlickerTestData() 54