Add test for setting excludeLocalRoutes

Bug: 184750836
Test: atest FrameworksNetTests
Change-Id: I4e79467ce7afcf07f4b8d7f964a605703a6d2c5e
This commit is contained in:
Chiachang Wang
2022-01-06 16:55:41 +08:00
parent 4ab1ffca29
commit b4a319bf24

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();