Merge "Add getters to UnderlyingNetworkInfo"

This commit is contained in:
Treehugger Robot
2021-04-29 07:29:08 +00:00
committed by Gerrit Code Review
2 changed files with 10 additions and 9 deletions

View File

@@ -50,6 +50,7 @@ import com.google.android.collect.Sets;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.Arrays;
import java.util.HashSet;
@RunWith(AndroidJUnit4.class)
@@ -616,7 +617,7 @@ public class NetworkStatsTest {
.insertEntry(underlyingIface, tunUid, SET_FOREGROUND, TAG_NONE, METERED_NO,
ROAMING_NO, DEFAULT_NETWORK_NO, 0L, 0L, 0L, 0L, 0L);
delta.migrateTun(tunUid, tunIface, new String[]{underlyingIface});
delta.migrateTun(tunUid, tunIface, Arrays.asList(underlyingIface));
assertEquals(20, delta.size());
// tunIface and TEST_IFACE entries are not changed.
@@ -697,7 +698,7 @@ public class NetworkStatsTest {
.insertEntry(underlyingIface, tunUid, SET_DEFAULT, TAG_NONE, METERED_NO, ROAMING_NO,
DEFAULT_NETWORK_NO, 75500L, 37L, 130000L, 70L, 0L);
delta.migrateTun(tunUid, tunIface, new String[]{underlyingIface});
delta.migrateTun(tunUid, tunIface, Arrays.asList(underlyingIface));
assertEquals(9, delta.size());
// tunIface entries should not be changed.

View File

@@ -5819,10 +5819,10 @@ public class ConnectivityServiceTest {
if (vpnUid != null) {
assertEquals("Should have exactly one VPN:", 1, infos.length);
UnderlyingNetworkInfo info = infos[0];
assertEquals("Unexpected VPN owner:", (int) vpnUid, info.ownerUid);
assertEquals("Unexpected VPN interface:", vpnIfname, info.iface);
assertEquals("Unexpected VPN owner:", (int) vpnUid, info.getOwnerUid());
assertEquals("Unexpected VPN interface:", vpnIfname, info.getIface());
assertSameElementsNoDuplicates(underlyingIfaces,
info.underlyingIfaces.toArray(new String[0]));
info.getUnderlyingIfaces().toArray(new String[0]));
} else {
assertEquals(0, infos.length);
return;
@@ -5966,8 +5966,8 @@ public class ConnectivityServiceTest {
// network for the VPN...
verify(mStatsManager, never()).notifyNetworkStatus(any(List.class),
any(List.class), any() /* anyString() doesn't match null */,
argThat(infos -> infos.get(0).underlyingIfaces.size() == 1
&& WIFI_IFNAME.equals(infos.get(0).underlyingIfaces.get(0))));
argThat(infos -> infos.get(0).getUnderlyingIfaces().size() == 1
&& WIFI_IFNAME.equals(infos.get(0).getUnderlyingIfaces().get(0))));
verifyNoMoreInteractions(mStatsManager);
reset(mStatsManager);
@@ -5980,8 +5980,8 @@ public class ConnectivityServiceTest {
waitForIdle();
verify(mStatsManager).notifyNetworkStatus(any(List.class),
any(List.class), any() /* anyString() doesn't match null */,
argThat(vpnInfos -> vpnInfos.get(0).underlyingIfaces.size() == 1
&& WIFI_IFNAME.equals(vpnInfos.get(0).underlyingIfaces.get(0))));
argThat(vpnInfos -> vpnInfos.get(0).getUnderlyingIfaces().size() == 1
&& WIFI_IFNAME.equals(vpnInfos.get(0).getUnderlyingIfaces().get(0))));
mEthernetNetworkAgent.disconnect();
waitForIdle();
reset(mStatsManager);