diff options
| author | Mark Chien <markchien@google.com> | 2022-04-06 09:14:19 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-04-06 09:14:19 +0000 |
| commit | 60f25d6c5b51a2e6e89aca122025adc7d9acb5de (patch) | |
| tree | 4519603cdff9ae5b6eeb8fd88c431a11274abe2e /Tethering/tests/unit/src/android/net/ip/IpServerTest.java | |
| parent | a79559084bc5637a306aff5cc0713118adf4013e (diff) | |
| parent | fb65dfeb8da0c0ce4ec8ac63099ede54195e4da2 (diff) | |
Merge "Add config_p2p_leases_subnet_prefix_length configuration"
Diffstat (limited to 'Tethering/tests/unit/src/android/net/ip/IpServerTest.java')
| -rw-r--r-- | Tethering/tests/unit/src/android/net/ip/IpServerTest.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Tethering/tests/unit/src/android/net/ip/IpServerTest.java b/Tethering/tests/unit/src/android/net/ip/IpServerTest.java index 6488421464..43f1eaa7d7 100644 --- a/Tethering/tests/unit/src/android/net/ip/IpServerTest.java +++ b/Tethering/tests/unit/src/android/net/ip/IpServerTest.java @@ -156,6 +156,8 @@ public class IpServerTest { private static final int BLUETOOTH_DHCP_PREFIX_LENGTH = 24; private static final int DHCP_LEASE_TIME_SECS = 3600; private static final boolean DEFAULT_USING_BPF_OFFLOAD = true; + private static final int DEFAULT_SUBNET_PREFIX_LENGTH = 0; + private static final int P2P_SUBNET_PREFIX_LENGTH = 25; private static final InterfaceParams TEST_IFACE_PARAMS = new InterfaceParams( IFACE_NAME, 42 /* index */, MacAddress.ALL_ZEROS_ADDRESS, 1500 /* defaultMtu */); @@ -230,6 +232,7 @@ public class IpServerTest { when(mTetherConfig.isBpfOffloadEnabled()).thenReturn(usingBpfOffload); when(mTetherConfig.useLegacyDhcpServer()).thenReturn(usingLegacyDhcp); + when(mTetherConfig.getP2pLeasesSubnetPrefixLength()).thenReturn(P2P_SUBNET_PREFIX_LENGTH); mIpServer = new IpServer( IFACE_NAME, mLooper.getLooper(), interfaceType, mSharedLog, mNetd, mBpfCoordinator, mCallback, mTetherConfig, mAddressCoordinator, mDependencies); @@ -1312,6 +1315,12 @@ public class IpServerTest { if (mIpServer.interfaceType() == TETHERING_NCM) { assertTrue(params.changePrefixOnDecline); } + + if (mIpServer.interfaceType() == TETHERING_WIFI_P2P) { + assertEquals(P2P_SUBNET_PREFIX_LENGTH, params.leasesSubnetPrefixLength); + } else { + assertEquals(DEFAULT_SUBNET_PREFIX_LENGTH, params.leasesSubnetPrefixLength); + } } private void assertDhcpStarted(IpPrefix expectedPrefix) throws Exception { |
