1 /*
2  * Copyright (C) 2022 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.cuttlefish.tests.utils;
18 
19 import com.android.tradefed.device.ITestDevice;
20 import com.android.tradefed.device.cloud.RemoteAndroidVirtualDevice;
21 import com.android.tradefed.log.LogUtil.CLog;
22 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
23 import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
24 import com.android.tradefed.util.CommandResult;
25 
26 import org.junit.Before;
27 import org.junit.runner.RunWith;
28 
29 /**
30  * Base test class for interacting with a Cuttlefish device with host binaries.
31  */
32 public abstract class CuttlefishHostTest extends BaseHostJUnit4Test {
33 
34     protected CuttlefishControlRunner runner;
35 
36     @Before
cuttlefishHostTestSetUp()37     public void cuttlefishHostTestSetUp() throws Exception {
38         ITestDevice device = getDevice();
39         CLog.i("Test Device Class Name: " + device.getClass().getSimpleName());
40         if (device instanceof RemoteAndroidVirtualDevice) {
41             runner = new CuttlefishControlRemoteRunner((RemoteAndroidVirtualDevice)device);
42         } else {
43             runner = new CuttlefishControlLocalRunner(getTestInformation());
44         }
45     }
46 
47 }
48