Merge "Fix CtsNetTestCases in instant mode" am: 81be2bd036

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1753823

Change-Id: I84ec31354974c4913d6c4ac94a955054697180ff
This commit is contained in:
Remi NGUYEN VAN
2021-07-02 04:19:02 +00:00
committed by Automerger Merge Worker
3 changed files with 21 additions and 0 deletions

View File

@@ -35,6 +35,7 @@ import android.os.BatteryStatsManager;
import android.os.Build;
import android.os.connectivity.CellularBatteryStats;
import android.os.connectivity.WifiBatteryStats;
import android.platform.test.annotations.AppModeFull;
import android.util.Log;
import androidx.test.runner.AndroidJUnit4;
@@ -80,6 +81,7 @@ public class BatteryStatsManagerTest{
}
@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")
public void testReportNetworkInterfaceForTransports() throws Exception {
try {
@@ -132,6 +134,7 @@ public class BatteryStatsManagerTest{
}
@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R)
@AppModeFull(reason = "Cannot get WifiManager in instant app mode")
@Test
public void testReportNetworkInterfaceForTransports_throwsSecurityException()
throws Exception {

View File

@@ -101,6 +101,7 @@ import com.android.testutils.RecorderCallback.CallbackEntry.Lost
import com.android.testutils.TestableNetworkCallback
import org.junit.After
import org.junit.Assert.assertArrayEquals
import org.junit.Assume.assumeFalse
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -1034,6 +1035,9 @@ class NetworkAgentTest {
@Test
fun testQosCallbackRegisterWithUnregister() {
// Instant apps can't bind sockets to localhost
// TODO: use @AppModeFull when supported by DevSdkIgnoreRunner
assumeFalse(realContext.packageManager.isInstantApp())
val (agent, socket) = setupForQosCallbackTesting()
val qosCallback = TestableQosCallback()
@@ -1060,6 +1064,9 @@ class NetworkAgentTest {
@Test
fun testQosCallbackOnQosSession() {
// Instant apps can't bind sockets to localhost
// TODO: use @AppModeFull when supported by DevSdkIgnoreRunner
assumeFalse(realContext.packageManager.isInstantApp())
val (agent, socket) = setupForQosCallbackTesting()
val qosCallback = TestableQosCallback()
Executors.newSingleThreadExecutor().let { executor ->
@@ -1104,6 +1111,9 @@ class NetworkAgentTest {
@Test
fun testQosCallbackOnError() {
// Instant apps can't bind sockets to localhost
// TODO: use @AppModeFull when supported by DevSdkIgnoreRunner
assumeFalse(realContext.packageManager.isInstantApp())
val (agent, socket) = setupForQosCallbackTesting()
val qosCallback = TestableQosCallback()
Executors.newSingleThreadExecutor().let { executor ->
@@ -1142,6 +1152,9 @@ class NetworkAgentTest {
@Test
fun testQosCallbackIdsAreMappedCorrectly() {
// Instant apps can't bind sockets to localhost
// TODO: use @AppModeFull when supported by DevSdkIgnoreRunner
assumeFalse(realContext.packageManager.isInstantApp())
val (agent, socket) = setupForQosCallbackTesting()
val qosCallback1 = TestableQosCallback()
val qosCallback2 = TestableQosCallback()
@@ -1182,6 +1195,9 @@ class NetworkAgentTest {
@Test
fun testQosCallbackWhenNetworkReleased() {
// Instant apps can't bind sockets to localhost
// TODO: use @AppModeFull when supported by DevSdkIgnoreRunner
assumeFalse(realContext.packageManager.isInstantApp())
val (agent, socket) = setupForQosCallbackTesting()
Executors.newSingleThreadExecutor().let { executor ->
try {

View File

@@ -35,6 +35,7 @@ import android.net.Proxy;
import android.net.ProxyInfo;
import android.net.Uri;
import android.os.Build;
import android.platform.test.annotations.AppModeFull;
import android.util.Log;
import android.util.Range;
@@ -145,6 +146,7 @@ public final class PacProxyManagerTest {
}
}
@AppModeFull(reason = "Instant apps can't bind sockets to localhost for a test proxy server")
@Test
public void testSetCurrentProxyScriptUrl() throws Exception {
// Register a PacProxyInstalledListener