Add tests for always-on VPN lockdown mode.
This requires mocking lots of new things that weren't mocked before but is otherwise fairly straightforward. A few changes to MockVpn are needed as well: 1. Set the VPN's NetworkInfo to CONNECTED, so methods such as isBlockingUid will work. While I'm at it, set the interface on the LinkProperties as well to make things a bit more realistic. 2. Constructs the VpnConfig when registering the agent, not when the MockVpn is created. This is needed because starting and stopping lockdown VPN calls prepare, which nulls out mConfig. But constructing the VpnConfig when registering the agent is more realistic anyway. The production code does that in establish, but we can't do that in ConnectivityServiceTest because some of the test cases don't call establish and call registerAgent directly. Bug: 173331190 Test: atest FrameworksNetTests Change-Id: I827543751dbf5e626a24ec02cd6f50b423f5f761
Loading
Please register or sign in to comment