Also support 464xlat on SUSPENDED networks

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 65684232

Change-Id: I1b10aab01554b1f926ec7157dba78645fdaff90f
This commit is contained in:
Erik Kline
2017-09-21 17:28:10 +09:00
parent 85afa50569
commit 0b01b0f191
3 changed files with 38 additions and 9 deletions

View File

@@ -84,6 +84,32 @@ public class Nat464XlatTest {
when(mConfig.getLinkAddress()).thenReturn(ADDR);
}
@Test
public void testRequiresClat() throws Exception {
final int[] supportedTypes = {
ConnectivityManager.TYPE_MOBILE,
ConnectivityManager.TYPE_WIFI,
ConnectivityManager.TYPE_ETHERNET,
};
// NetworkInfo doesn't allow setting the State directly, but rather
// requires setting DetailedState in order set State as a side-effect.
final NetworkInfo.DetailedState[] supportedDetailedStates = {
NetworkInfo.DetailedState.CONNECTED,
NetworkInfo.DetailedState.SUSPENDED,
};
for (int type : supportedTypes) {
mNai.networkInfo.setType(type);
for (NetworkInfo.DetailedState state : supportedDetailedStates) {
mNai.networkInfo.setDetailedState(state, "reason", "extraInfo");
assertTrue(
String.format("requiresClat expected for type=%d state=%s", type, state),
Nat464Xlat.requiresClat(mNai));
}
}
}
@Test
public void testNormalStartAndStop() throws Exception {
Nat464Xlat nat = makeNat464Xlat();