1 /* 2 * Copyright (C) 2020 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 com.android.cts.helpers; 18 19 import android.platform.helpers.ITestHelper; 20 21 /** 22 * An interface for device interaction helper classes that will be loaded into CTS tests at runtime 23 * by {@link HelperManager}. The @Rule ({@link DeviceInteractionHelperRule}) that test classes use 24 * to manage {@link HelperManager} enforces that concrete implementation classes must inherit from 25 * {@link ICtsDeviceInteractionHelper}, which ensures that helper classes are not loaded unless they 26 * were intended to be part of a test. 27 * 28 * <p>Because every CTS module needs a different set of abstractions, this interface imposes minimal 29 * structure. Each CTS module should define its own specific interface that extends {@link 30 * ICtsDeviceInteractionHelper} with whatever abstractions make sense for its particular device 31 * interactions. 32 */ 33 public interface ICtsDeviceInteractionHelper extends ITestHelper { 34 /** 35 * Perform any operations needed before the test runs. Should be called from the test's {@code 36 * setUp} method or another {@code @Before} method. 37 */ setUp()38 default void setUp() {}; 39 40 /** 41 * Perform any operations needed after the test runs. Should be called from the test's {@code 42 * tearDown} method or another {@code @After} method. 43 */ tearDown()44 default void tearDown() {}; 45 } 46