Create local NetworkCapabilites for MockVpn.
Store the mNetworkCapabilities locally in MockVpn to stop depending on the Vpn class. Bug: 230548427 Test: atest FrameworksNetTests Change-Id: I215e915dcafb6700950bc8a500bc16f839d0e13e
This commit is contained in:
@@ -1507,6 +1507,18 @@ public class ConnectivityServiceTest {
|
|||||||
// Careful ! This is different from mNetworkAgent, because MockNetworkAgent does
|
// Careful ! This is different from mNetworkAgent, because MockNetworkAgent does
|
||||||
// not inherit from NetworkAgent.
|
// not inherit from NetworkAgent.
|
||||||
private TestNetworkAgentWrapper mMockNetworkAgent;
|
private TestNetworkAgentWrapper mMockNetworkAgent;
|
||||||
|
// Initialize a stored NetworkCapabilities following the defaults of VPN. The TransportInfo
|
||||||
|
// should at least be updated to a valid VPN type before usage, see registerAgent(...).
|
||||||
|
private NetworkCapabilities mNetworkCapabilities = new NetworkCapabilities.Builder()
|
||||||
|
.addTransportType(NetworkCapabilities.TRANSPORT_VPN)
|
||||||
|
.removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)
|
||||||
|
.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VCN_MANAGED)
|
||||||
|
.setTransportInfo(new VpnTransportInfo(
|
||||||
|
VpnManager.TYPE_VPN_NONE,
|
||||||
|
null /* sessionId */,
|
||||||
|
false /* bypassable */,
|
||||||
|
false /* longLivedTcpConnectionsExpensive */))
|
||||||
|
.build();
|
||||||
private boolean mAgentRegistered = false;
|
private boolean mAgentRegistered = false;
|
||||||
|
|
||||||
private int mVpnType = VpnManager.TYPE_VPN_SERVICE;
|
private int mVpnType = VpnManager.TYPE_VPN_SERVICE;
|
||||||
|
|||||||
Reference in New Issue
Block a user