Merge "Fix a flake with mocking." am: 527f040944

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1762391

Change-Id: Ie8f389c1df00c68514dad1ac620b32ed34c2e22a
This commit is contained in:
Treehugger Robot
2021-07-19 12:36:34 +00:00
committed by Automerger Merge Worker

View File

@@ -1529,7 +1529,7 @@ public class ConnectivityServiceTest {
}
private <T> T doAsUid(final int uid, @NonNull final Supplier<T> what) {
when(mDeps.getCallingUid()).thenReturn(uid);
doReturn(uid).when(mDeps).getCallingUid();
try {
return what.get();
} finally {
@@ -9860,9 +9860,9 @@ public class ConnectivityServiceTest {
assertVpnUidRangesUpdated(true, vpnRange, vpnOwnerUid);
final UnderlyingNetworkInfo underlyingNetworkInfo =
new UnderlyingNetworkInfo(vpnOwnerUid, VPN_IFNAME, new ArrayList<String>());
new UnderlyingNetworkInfo(vpnOwnerUid, VPN_IFNAME, new ArrayList<>());
mMockVpn.setUnderlyingNetworkInfo(underlyingNetworkInfo);
when(mDeps.getConnectionOwnerUid(anyInt(), any(), any())).thenReturn(42);
doReturn(42).when(mDeps).getConnectionOwnerUid(anyInt(), any(), any());
}
private void setupConnectionOwnerUidAsVpnApp(int vpnOwnerUid, @VpnManager.VpnType int vpnType)