Mock Vpn.setLockdown()

Call setRequireVpnForUids directly to enable lockdown instead of
calling the real Vpn method.

Bug: 230548427
Test: atest FrameworksNetTests
Change-Id: I91ec59f7542d145e9250a7e7a414593db3d99424
This commit is contained in:
Hansen Kurli
2023-09-12 15:05:46 +08:00
parent ed972a6fd2
commit 39654c33cf

View File

@@ -10206,7 +10206,8 @@ public class ConnectivityServiceTest {
// Init lockdown state to simulate LockdownVpnTracker behavior.
mCm.setLegacyLockdownVpnEnabled(true);
mMockVpn.setEnableTeardown(false);
mMockVpn.setLockdown(true);
final Set<Range<Integer>> ranges = UidRange.toIntRanges(Set.of(PRIMARY_UIDRANGE));
mCm.setRequireVpnForUids(true /* requireVpn */, ranges);
// Bring up a network.
final LinkProperties cellLp = new LinkProperties();