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
This commit is contained in:
Lorenzo Colitti
2021-02-06 01:18:40 +09:00
parent 96742d9695
commit e9192a51f4

View File

@@ -953,14 +953,7 @@ public class VpnTest {
} }
private Vpn startLegacyVpn(final Vpn vpn, final VpnProfile vpnProfile) throws Exception { 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 setMockedUsers(primaryUser);
// API, remove this ad-hoc setup code and use setMockedUsers(primaryUser) again.
// setMockedUsers(primaryUser);
final ArrayList<UserInfo> users = new ArrayList<>();
users.add(primaryUser);
when(mUserManager.getAliveUsers()).thenReturn(users);
when(mUserManager.getUserInfo(primaryUser.id)).thenReturn(primaryUser);
when(mUserManager.canHaveRestrictedProfile()).thenReturn(false);
// Dummy egress interface // Dummy egress interface
final LinkProperties lp = new LinkProperties(); final LinkProperties lp = new LinkProperties();
@@ -1159,10 +1152,6 @@ public class VpnTest {
doReturn(UserHandle.of(userId)).when(asUserContext).getUser(); doReturn(UserHandle.of(userId)).when(asUserContext).getUser();
when(mContext.createContextAsUser(eq(UserHandle.of(userId)), anyInt())) when(mContext.createContextAsUser(eq(UserHandle.of(userId)), anyInt()))
.thenReturn(asUserContext); .thenReturn(asUserContext);
when(asUserContext.getSystemServiceName(UserManager.class))
.thenReturn(Context.USER_SERVICE);
when(asUserContext.getSystemService(UserManager.class))
.thenReturn(mUserManager);
final TestLooper testLooper = new TestLooper(); final TestLooper testLooper = new TestLooper();
final Vpn vpn = new Vpn(testLooper.getLooper(), mContext, new TestDeps(), mNetService, final Vpn vpn = new Vpn(testLooper.getLooper(), mContext, new TestDeps(), mNetService,
mNetd, userId, mKeyStore, mSystemServices, mIkev2SessionCreator); mNetd, userId, mKeyStore, mSystemServices, mIkev2SessionCreator);