From e9192a51f43ba04a4a155964fa92d155237fa0cd Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Sat, 6 Feb 2021 01:18:40 +0900 Subject: [PATCH] Remove temporary hack in VpnTest. This temporary hack was necessary due to b/175883995. Now that that bug is fixed, remove the hack. Bug: 171529940 Test: test-only change Change-Id: I48bd594cf3a37575f4888c1be9a1cf535de2e4d2 --- .../com/android/server/connectivity/VpnTest.java | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/tests/net/java/com/android/server/connectivity/VpnTest.java b/tests/net/java/com/android/server/connectivity/VpnTest.java index 32c6a75bd9..73cc9f129e 100644 --- a/tests/net/java/com/android/server/connectivity/VpnTest.java +++ b/tests/net/java/com/android/server/connectivity/VpnTest.java @@ -953,14 +953,7 @@ public class VpnTest { } private Vpn startLegacyVpn(final Vpn vpn, final VpnProfile vpnProfile) throws Exception { - // TODO(b/175883995): once these tests have been updated for the changes to the UserManager - // API, remove this ad-hoc setup code and use setMockedUsers(primaryUser) again. - // setMockedUsers(primaryUser); - final ArrayList users = new ArrayList<>(); - users.add(primaryUser); - when(mUserManager.getAliveUsers()).thenReturn(users); - when(mUserManager.getUserInfo(primaryUser.id)).thenReturn(primaryUser); - when(mUserManager.canHaveRestrictedProfile()).thenReturn(false); + setMockedUsers(primaryUser); // Dummy egress interface final LinkProperties lp = new LinkProperties(); @@ -1159,10 +1152,6 @@ public class VpnTest { doReturn(UserHandle.of(userId)).when(asUserContext).getUser(); when(mContext.createContextAsUser(eq(UserHandle.of(userId)), anyInt())) .thenReturn(asUserContext); - when(asUserContext.getSystemServiceName(UserManager.class)) - .thenReturn(Context.USER_SERVICE); - when(asUserContext.getSystemService(UserManager.class)) - .thenReturn(mUserManager); final TestLooper testLooper = new TestLooper(); final Vpn vpn = new Vpn(testLooper.getLooper(), mContext, new TestDeps(), mNetService, mNetd, userId, mKeyStore, mSystemServices, mIkev2SessionCreator);