Merge "Add test for ConnectivityManager.setGlobalProxy()" am: 78c1663ba3 am: 650927c734

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

Change-Id: Id68f9718dedfdc294bda304c99e1d84281497e2c
This commit is contained in:
Chiachang Wang
2021-05-13 10:07:37 +00:00
committed by Automerger Merge Worker

View File

@@ -102,6 +102,7 @@ import android.net.NetworkInfo.DetailedState;
import android.net.NetworkInfo.State; import android.net.NetworkInfo.State;
import android.net.NetworkRequest; import android.net.NetworkRequest;
import android.net.NetworkUtils; import android.net.NetworkUtils;
import android.net.ProxyInfo;
import android.net.SocketKeepalive; import android.net.SocketKeepalive;
import android.net.TestNetworkInterface; import android.net.TestNetworkInterface;
import android.net.TestNetworkManager; import android.net.TestNetworkManager;
@@ -1912,4 +1913,12 @@ public class ConnectivityManagerTest {
assertNull(NetworkInformationShimImpl.newInstance() assertNull(NetworkInformationShimImpl.newInstance()
.getCapabilityCarrierName(ConstantsShim.NET_CAPABILITY_NOT_VCN_MANAGED)); .getCapabilityCarrierName(ConstantsShim.NET_CAPABILITY_NOT_VCN_MANAGED));
} }
@Test
public void testSetGlobalProxy() {
assumeTrue(TestUtils.shouldTestSApis());
// Behavior is verified in gts. Verify exception thrown w/o permission.
assertThrows(SecurityException.class, () -> mCm.setGlobalProxy(
ProxyInfo.buildDirectProxy("example.com" /* host */, 8080 /* port */)));
}
} }