Merge "Add testIpv4AddressForSapAndLohsConcurrency test case" am: f4ef96c62f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2561990
Change-Id: I223473df2526acf6946ebed691da5db037c10cf6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java
index 687171b..c0f5c61 100644
--- a/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java
+++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java
@@ -3541,6 +3541,29 @@
assertEquals(expectedTypes.size() > 0, mTethering.isTetheringSupported());
callback.expectSupportedTetheringTypes(expectedTypes);
}
+
+ @Test
+ public void testIpv4AddressForSapAndLohsConcurrency() throws Exception {
+ mTethering.interfaceStatusChanged(TEST_WLAN_IFNAME, true);
+ sendWifiApStateChanged(WIFI_AP_STATE_ENABLED, TEST_WLAN_IFNAME, IFACE_IP_MODE_TETHERED);
+
+ ArgumentCaptor<InterfaceConfigurationParcel> ifaceConfigCaptor =
+ ArgumentCaptor.forClass(InterfaceConfigurationParcel.class);
+ verify(mNetd).interfaceSetCfg(ifaceConfigCaptor.capture());
+ InterfaceConfigurationParcel ifaceConfig = ifaceConfigCaptor.getValue();
+ final IpPrefix sapPrefix = new IpPrefix(
+ InetAddresses.parseNumericAddress(ifaceConfig.ipv4Addr), ifaceConfig.prefixLength);
+
+ mTethering.interfaceStatusChanged(TEST_WLAN2_IFNAME, true);
+ sendWifiApStateChanged(WIFI_AP_STATE_ENABLED, TEST_WLAN2_IFNAME, IFACE_IP_MODE_LOCAL_ONLY);
+
+ ifaceConfigCaptor = ArgumentCaptor.forClass(InterfaceConfigurationParcel.class);
+ verify(mNetd, times(2)).interfaceSetCfg(ifaceConfigCaptor.capture());
+ ifaceConfig = ifaceConfigCaptor.getValue();
+ final IpPrefix lohsPrefix = new IpPrefix(
+ InetAddresses.parseNumericAddress(ifaceConfig.ipv4Addr), ifaceConfig.prefixLength);
+ assertFalse(sapPrefix.equals(lohsPrefix));
+ }
// TODO: Test that a request for hotspot mode doesn't interfere with an
// already operating tethering mode interface.
}