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 
27 /**
28  * Defines the runner for the flicker tests. This component is responsible for running the flicker
29  * tests and executing assertions on the traces to check for inconsistent behaviors on
30  * [WindowManagerTrace] and [LayersTrace]
31  */
32 @FlickerDslMarker
33 open class FlickerTestDataImpl(
34     /** Instrumentation to run the tests */
35     override val instrumentation: Instrumentation,
36     /** Test automation component used to interact with the device */
37     override val device: UiDevice,
38     /** Output directory for test results */
39     override val outputDir: File,
40     /** Enabled tracing monitors */
41     override val traceMonitors: List<ITransitionMonitor>,
42     /** Commands to be executed before the transition */
43     override val transitionSetup: List<FlickerTestData.() -> Any>,
44     /** Test commands */
45     override val transitions: List<FlickerTestData.() -> Any>,
46     /** Commands to be executed after the transition */
47     override val transitionTeardown: List<FlickerTestData.() -> Any>,
48     /** Helper object for WM Synchronization */
49     override val wmHelper: WindowManagerStateHelper
50 ) : AbstractFlickerTestData()
51