Add RequiresDevice to relevant tests
Replace SkipPresubmit with RequiresDevice on relevant tests, as RequiresDevices is more standard and more specific. This allows creating test configurations using virtual devices which are not necessarily in presubmit. Bug: 201014262 Test: TH needs to verify test mapping run with new annotation Change-Id: I6758d2a41a9a987a5244e47e4795bc49889c4d61
This commit is contained in:
@@ -12,6 +12,9 @@
|
||||
"options": [
|
||||
{
|
||||
"exclude-annotation": "com.android.testutils.SkipPresubmit"
|
||||
},
|
||||
{
|
||||
"exclude-annotation": "androidx.test.filters.RequiresDevice"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -33,6 +36,9 @@
|
||||
"options": [
|
||||
{
|
||||
"exclude-annotation": "com.android.testutils.SkipPresubmit"
|
||||
},
|
||||
{
|
||||
"exclude-annotation": "androidx.test.filters.RequiresDevice"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -41,11 +41,11 @@ import android.os.connectivity.WifiBatteryStats;
|
||||
import android.platform.test.annotations.AppModeFull;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.test.filters.RequiresDevice;
|
||||
import androidx.test.filters.SdkSuppress;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.testutils.DevSdkIgnoreRule;
|
||||
import com.android.testutils.SkipPresubmit;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
@@ -94,7 +94,7 @@ public class BatteryStatsManagerTest{
|
||||
// properly.
|
||||
@Test
|
||||
@AppModeFull(reason = "Cannot get CHANGE_NETWORK_STATE to request wifi/cell in instant mode")
|
||||
@SkipPresubmit(reason = "Virtual hardware does not support wifi battery stats")
|
||||
@RequiresDevice // Virtual hardware does not support wifi battery stats
|
||||
public void testReportNetworkInterfaceForTransports() throws Exception {
|
||||
try {
|
||||
// Simulate the device being unplugged from charging.
|
||||
|
||||
@@ -155,6 +155,7 @@ import android.util.Pair;
|
||||
import android.util.Range;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.filters.RequiresDevice;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
@@ -168,7 +169,6 @@ import com.android.testutils.DevSdkIgnoreRule;
|
||||
import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
|
||||
import com.android.testutils.DevSdkIgnoreRuleKt;
|
||||
import com.android.testutils.RecorderCallback.CallbackEntry;
|
||||
import com.android.testutils.SkipPresubmit;
|
||||
import com.android.testutils.TestHttpServer;
|
||||
import com.android.testutils.TestNetworkTracker;
|
||||
import com.android.testutils.TestableNetworkCallback;
|
||||
@@ -559,7 +559,7 @@ public class ConnectivityManagerTest {
|
||||
*/
|
||||
@AppModeFull(reason = "Cannot get WifiManager in instant app mode")
|
||||
@Test
|
||||
@SkipPresubmit(reason = "Virtual devices use a single internet connection for all networks")
|
||||
@RequiresDevice // Virtual devices use a single internet connection for all networks
|
||||
public void testOpenConnection() throws Exception {
|
||||
assumeTrue(mPackageManager.hasSystemFeature(FEATURE_WIFI));
|
||||
assumeTrue(mPackageManager.hasSystemFeature(FEATURE_TELEPHONY));
|
||||
@@ -1425,7 +1425,7 @@ public class ConnectivityManagerTest {
|
||||
|
||||
@AppModeFull(reason = "Cannot get WifiManager in instant app mode")
|
||||
@Test
|
||||
@SkipPresubmit(reason = "Keepalive is not supported on virtual hardware")
|
||||
@RequiresDevice // Keepalive is not supported on virtual hardware
|
||||
public void testCreateTcpKeepalive() throws Exception {
|
||||
assumeTrue(mPackageManager.hasSystemFeature(FEATURE_WIFI));
|
||||
|
||||
@@ -1632,7 +1632,7 @@ public class ConnectivityManagerTest {
|
||||
*/
|
||||
@AppModeFull(reason = "Cannot get WifiManager in instant app mode")
|
||||
@Test
|
||||
@SkipPresubmit(reason = "Keepalive is not supported on virtual hardware")
|
||||
@RequiresDevice // Keepalive is not supported on virtual hardware
|
||||
public void testSocketKeepaliveLimitWifi() throws Exception {
|
||||
assumeTrue(mPackageManager.hasSystemFeature(FEATURE_WIFI));
|
||||
|
||||
@@ -1682,7 +1682,7 @@ public class ConnectivityManagerTest {
|
||||
*/
|
||||
@AppModeFull(reason = "Cannot request network in instant app mode")
|
||||
@Test
|
||||
@SkipPresubmit(reason = "Keepalive is not supported on virtual hardware")
|
||||
@RequiresDevice // Keepalive is not supported on virtual hardware
|
||||
public void testSocketKeepaliveLimitTelephony() throws Exception {
|
||||
if (!mPackageManager.hasSystemFeature(FEATURE_TELEPHONY)) {
|
||||
Log.i(TAG, "testSocketKeepaliveLimitTelephony cannot execute unless device"
|
||||
@@ -1728,7 +1728,7 @@ public class ConnectivityManagerTest {
|
||||
*/
|
||||
@AppModeFull(reason = "Cannot get WifiManager in instant app mode")
|
||||
@Test
|
||||
@SkipPresubmit(reason = "Keepalive is not supported on virtual hardware")
|
||||
@RequiresDevice // Keepalive is not supported on virtual hardware
|
||||
public void testSocketKeepaliveUnprivileged() throws Exception {
|
||||
assumeTrue(mPackageManager.hasSystemFeature(FEATURE_WIFI));
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.net.cts;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.ConnectivityManager.NetworkCallback;
|
||||
@@ -27,7 +26,7 @@ import android.os.SystemClock;
|
||||
import android.test.AndroidTestCase;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.testutils.SkipPresubmit;
|
||||
import androidx.test.filters.RequiresDevice;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.Inet6Address;
|
||||
@@ -70,7 +69,7 @@ public class DnsTest extends AndroidTestCase {
|
||||
* Perf - measure size of first and second tier caches and their effect
|
||||
* Assert requires network permission
|
||||
*/
|
||||
@SkipPresubmit(reason = "IPv6 support may be missing on presubmit virtual hardware")
|
||||
@RequiresDevice // IPv6 support may be missing on presubmit virtual hardware
|
||||
public void testDnsWorks() throws Exception {
|
||||
ensureIpv6Connectivity();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user