Merge "Add test for setting excludeLocalRoutes" am: da13f899e3 am: a460e2e474

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1937330

Change-Id: I3072bab23bae32c1182096cb566529a6a3594778
This commit is contained in:
Chiachang Wang
2022-01-11 09:33:29 +00:00
committed by Automerger Merge Worker

View File

@@ -259,6 +259,28 @@ public class Ikev2VpnProfileTest {
}
}
// TODO: Refer to Build.VERSION_CODES.SC_V2 when it's available in AOSP
@DevSdkIgnoreRule.IgnoreUpTo(32)
@Test
public void testBuildExcludeLocalRoutesSet() throws Exception {
final Ikev2VpnProfile.Builder builder = getBuilderWithDefaultOptions();
builder.setAuthPsk(PSK_BYTES);
builder.setExcludeLocalRoutes(true);
final Ikev2VpnProfile profile = builder.build();
assertNotNull(profile);
assertTrue(profile.getExcludeLocalRoutes());
builder.setBypassable(false);
try {
builder.build();
fail("Expected exception because excludeLocalRoutes should be set only"
+ " on the bypassable VPN");
} catch (IllegalArgumentException expected) {
}
}
@Test
public void testBuildInvalidMtu() throws Exception {
final Ikev2VpnProfile.Builder builder = getBuilderWithDefaultOptions();