summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatt Lee <matthewhlee@google.com>2022-06-12 23:19:47 +0000
committerMatt Lee <matthewhlee@google.com>2022-06-12 23:19:47 +0000
commit2ee3b28251c8f6864a6dbcd229b7a1641a4782e4 (patch)
tree3577b78cd7727ed3695b831753db86a62462ed7b /tests
parent64c414abd49acc8d488837ab90b51d822c23e66d (diff)
Revert "Merge s-mpr-2022-06"
Revert submission 732792 Reason for revert: build failure Reverted Changes: I3cbe7c924:Merge s-mpr-2022-06 I9881453ba:Don't set background color if TDA doesn't have a v... I57fa88c6f:Use TDA for background color instead of new color ... Ic2fa89b76:Dialing phone state should update active sub Change-Id: I9709841558bfcb325f7e205f5f5ec89c620d14dd
Diffstat (limited to 'tests')
-rw-r--r--tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java5
-rw-r--r--tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionTest.java70
2 files changed, 1 insertions, 74 deletions
diff --git a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java
index a687bb893c4a..7b5f0b180c6e 100644
--- a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java
+++ b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java
@@ -307,10 +307,7 @@ public class VcnGatewayConnectionConnectedStateTest extends VcnGatewayConnection
ncCaptor.capture(),
lpCaptor.capture(),
any(),
- // Subtype integer/name and extras do not have getters; cannot be tested.
- argThat(nac -> nac.getLegacyType() == ConnectivityManager.TYPE_MOBILE
- && nac.getLegacyTypeName().equals(
- VcnGatewayConnection.NETWORK_INFO_NETWORK_TYPE_STRING)),
+ argThat(nac -> nac.getLegacyType() == ConnectivityManager.TYPE_MOBILE),
any(),
any(),
any());
diff --git a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionTest.java b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionTest.java
index b8eefabea3c6..a7001713533c 100644
--- a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionTest.java
+++ b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionTest.java
@@ -16,7 +16,6 @@
package com.android.server.vcn;
-import static android.net.IpSecManager.IpSecTunnelInterface;
import static android.net.NetworkCapabilities.NET_CAPABILITY_DUN;
import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_METERED;
@@ -25,8 +24,6 @@ import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_VCN_MANAGED;
import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
-import static com.android.server.vcn.VcnGatewayConnection.DUMMY_ADDR;
-import static com.android.server.vcn.VcnGatewayConnection.VcnChildSessionConfiguration;
import static com.android.server.vcn.VcnGatewayConnection.VcnIkeSession;
import static com.android.server.vcn.VcnGatewayConnection.VcnNetworkAgent;
@@ -39,11 +36,8 @@ import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.CALLS_REAL_METHODS;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import android.net.IpSecManager;
-import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.Network;
import android.net.NetworkCapabilities;
@@ -65,11 +59,8 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.net.InetAddress;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -79,8 +70,6 @@ import java.util.UUID;
public class VcnGatewayConnectionTest extends VcnGatewayConnectionTestBase {
private static final int TEST_UID = Process.myUid() + 1;
- private static final String LOOPBACK_IFACE = "lo";
-
private static final ParcelUuid TEST_PARCEL_UUID = new ParcelUuid(UUID.randomUUID());
private static final int TEST_SIM_SLOT_INDEX = 1;
private static final int TEST_SUBSCRIPTION_ID_1 = 2;
@@ -88,12 +77,6 @@ public class VcnGatewayConnectionTest extends VcnGatewayConnectionTestBase {
private static final int TEST_SUBSCRIPTION_ID_2 = 3;
private static final SubscriptionInfo TEST_SUBINFO_2 = mock(SubscriptionInfo.class);
private static final Map<Integer, ParcelUuid> TEST_SUBID_TO_GROUP_MAP;
- private static final String TEST_TCP_BUFFER_SIZES = "1,2,3,4,5,6";
- private static final int TEST_MTU = 1300;
- private static final int TEST_MTU_DELTA = 64;
- private static final List<LinkAddress> TEST_INTERNAL_ADDRESSES =
- Arrays.asList(new LinkAddress(DUMMY_ADDR, 16));
- private static final List<InetAddress> TEST_DNS_ADDRESSES = Arrays.asList(DUMMY_ADDR);
private static final int TEST_UPSTREAM_BANDWIDTH = 1234;
private static final int TEST_DOWNSTREAM_BANDWIDTH = 2345;
@@ -183,59 +166,6 @@ public class VcnGatewayConnectionTest extends VcnGatewayConnectionTestBase {
}
@Test
- public void testBuildLinkProperties() throws Exception {
- final IpSecTunnelInterface tunnelIface =
- mContext.getSystemService(IpSecManager.class)
- .createIpSecTunnelInterface(
- DUMMY_ADDR, DUMMY_ADDR, TEST_UNDERLYING_NETWORK_RECORD_1.network);
-
- final LinkProperties underlyingLp = new LinkProperties();
- underlyingLp.setInterfaceName(LOOPBACK_IFACE);
- underlyingLp.setTcpBufferSizes(TEST_TCP_BUFFER_SIZES);
- doReturn(TEST_MTU).when(mDeps).getUnderlyingIfaceMtu(LOOPBACK_IFACE);
-
- final VcnChildSessionConfiguration childSessionConfig =
- mock(VcnChildSessionConfiguration.class);
- doReturn(TEST_INTERNAL_ADDRESSES).when(childSessionConfig).getInternalAddresses();
- doReturn(TEST_DNS_ADDRESSES).when(childSessionConfig).getInternalDnsServers();
-
- UnderlyingNetworkRecord record =
- new UnderlyingNetworkRecord(
- mock(Network.class, CALLS_REAL_METHODS),
- new NetworkCapabilities.Builder().build(),
- underlyingLp,
- false);
-
- final LinkProperties vcnLp1 =
- mGatewayConnection.buildConnectedLinkProperties(
- VcnGatewayConnectionConfigTest.buildTestConfig(),
- tunnelIface,
- childSessionConfig,
- record);
-
- verify(mDeps).getUnderlyingIfaceMtu(LOOPBACK_IFACE);
-
- // Instead of having to recalculate the final MTU (after accounting for IPsec overhead),
- // calculate another set of Link Properties with a lower MTU, and calculate the delta.
- doReturn(TEST_MTU - TEST_MTU_DELTA).when(mDeps).getUnderlyingIfaceMtu(LOOPBACK_IFACE);
-
- final LinkProperties vcnLp2 =
- mGatewayConnection.buildConnectedLinkProperties(
- VcnGatewayConnectionConfigTest.buildTestConfig(),
- tunnelIface,
- childSessionConfig,
- record);
-
- verify(mDeps, times(2)).getUnderlyingIfaceMtu(LOOPBACK_IFACE);
-
- assertEquals(tunnelIface.getInterfaceName(), vcnLp1.getInterfaceName());
- assertEquals(TEST_INTERNAL_ADDRESSES, vcnLp1.getLinkAddresses());
- assertEquals(TEST_DNS_ADDRESSES, vcnLp1.getDnsServers());
- assertEquals(TEST_TCP_BUFFER_SIZES, vcnLp1.getTcpBufferSizes());
- assertEquals(TEST_MTU_DELTA, vcnLp1.getMtu() - vcnLp2.getMtu());
- }
-
- @Test
public void testSubscriptionSnapshotUpdateNotifiesUnderlyingNetworkTracker() {
verifyWakeLockSetUp();