Merge "Install test app2 per test class for HostsideConnOnActivityStartTest" into main

This commit is contained in:
Treehugger Robot
2023-07-19 06:34:17 +00:00
committed by Gerrit Code Review
2 changed files with 15 additions and 11 deletions

View File

@@ -18,21 +18,24 @@ package com.android.cts.net;
import android.platform.test.annotations.FlakyTest;
import org.junit.After;
import org.junit.Before;
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.invoker.TestInformation;
import com.android.tradefed.testtype.junit4.AfterClassWithInfo;
import com.android.tradefed.testtype.junit4.BeforeClassWithInfo;
import org.junit.Test;
public class HostsideConnOnActivityStartTest extends HostsideNetworkTestCase {
private static final String TEST_CLASS = TEST_PKG + ".ConnOnActivityStartTest";
@Before
public void setUp() throws Exception {
uninstallPackage(TEST_APP2_PKG, false);
installPackage(TEST_APP2_APK);
@BeforeClassWithInfo
public static void setUpOnce(TestInformation testInfo) throws Exception {
uninstallPackage(testInfo, TEST_APP2_PKG, false);
installPackage(testInfo, TEST_APP2_APK);
}
@After
public void tearDown() throws Exception {
uninstallPackage(TEST_APP2_PKG, true);
@AfterClassWithInfo
public static void tearDownOnce(TestInformation testInfo) throws DeviceNotAvailableException {
uninstallPackage(testInfo, TEST_APP2_PKG, true);
}
@Test

View File

@@ -46,7 +46,7 @@ abstract class HostsideNetworkTestCase extends BaseHostJUnit4Test {
protected static final String TEST_APP2_APK = "CtsHostsideNetworkTestsApp2.apk";
@BeforeClassWithInfo
public static void setUpOnce(TestInformation testInfo) throws Exception {
public static void setUpOnceBase(TestInformation testInfo) throws Exception {
DeviceSdkLevel deviceSdkLevel = new DeviceSdkLevel(testInfo.getDevice());
String testApk = deviceSdkLevel.isDeviceAtLeastT() ? TEST_APK_NEXT : TEST_APK;
@@ -55,7 +55,8 @@ abstract class HostsideNetworkTestCase extends BaseHostJUnit4Test {
}
@AfterClassWithInfo
public static void tearDownOnce(TestInformation testInfo) throws DeviceNotAvailableException {
public static void tearDownOnceBase(TestInformation testInfo)
throws DeviceNotAvailableException {
uninstallPackage(testInfo, TEST_PKG, true);
}