Add test to verify null ProxyInfo in Ikev2VpnProfile

Bug: 244281603
Test: atest FrameworksNetTests
Change-Id: Ice195b60a0f62ae541ede9277c6e36f9c72b2dbb
This commit is contained in:
chiachangwang
2022-08-30 10:42:40 +00:00
parent f37dfa3a11
commit 715dc5b447

View File

@@ -471,6 +471,23 @@ public class Ikev2VpnProfileTest {
new Ikev2VpnProfile.Builder(tunnelParams2).build());
}
@Test
public void testBuildProfileWithNullProxy() throws Exception {
final Ikev2VpnProfile ikev2VpnProfile =
new Ikev2VpnProfile.Builder(SERVER_ADDR_STRING, IDENTITY_STRING)
.setAuthUsernamePassword(USERNAME_STRING, PASSWORD_STRING, mServerRootCa)
.build();
// ProxyInfo should be null for the profile without setting ProxyInfo.
assertNull(ikev2VpnProfile.getProxyInfo());
// ProxyInfo should stay null after performing toVpnProfile() and fromVpnProfile()
final VpnProfile vpnProfile = ikev2VpnProfile.toVpnProfile();
assertNull(vpnProfile.proxy);
final Ikev2VpnProfile convertedIkev2VpnProfile = Ikev2VpnProfile.fromVpnProfile(vpnProfile);
assertNull(convertedIkev2VpnProfile.getProxyInfo());
}
private static class CertificateAndKey {
public final X509Certificate cert;