Test VpnProfile is not modified in startLegacyVpn
The profile is modified within startLegacyVpnPrivileged(), e.g. ipsecCaCert, ipsecUserCert. This causes subsequent calls from callers such as LockdownVpnTracker to fail. Add a new test to ensure the VpnProfile is not modified in startLegacyVpn. Add testClone in VpnProfileTest. Bug: 190572822 Bug: 309591931 Test: atest FrameworksNetTests, test before and after fix. Test: Manual test Change-Id: Id090e0dd3b9e74a7461ae90e68c41e802b458744
This commit is contained in:
@@ -3131,6 +3131,20 @@ public class VpnTest extends VpnTestBase {
|
||||
startPptp(false /* useMppe */);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartLegacyVpnModifyProfile_TypePSK() throws Exception {
|
||||
setMockedUsers(PRIMARY_USER);
|
||||
final Vpn vpn = createVpn(PRIMARY_USER.id);
|
||||
final Ikev2VpnProfile ikev2VpnProfile =
|
||||
new Ikev2VpnProfile.Builder(TEST_VPN_SERVER, TEST_VPN_IDENTITY)
|
||||
.setAuthPsk(TEST_VPN_PSK)
|
||||
.build();
|
||||
final VpnProfile profile = ikev2VpnProfile.toVpnProfile();
|
||||
|
||||
startLegacyVpn(vpn, profile);
|
||||
assertEquals(profile, ikev2VpnProfile.toVpnProfile());
|
||||
}
|
||||
|
||||
private void assertTransportInfoMatches(NetworkCapabilities nc, int type) {
|
||||
assertNotNull(nc);
|
||||
VpnTransportInfo ti = (VpnTransportInfo) nc.getTransportInfo();
|
||||
|
||||
Reference in New Issue
Block a user