Clean up unit testing for ConnectivityDiagnostics.

Connectivity Diagnostics included an unnecessary try-catch for verifying
that the permissions check for invoking ConnectivityDiagnosticsCallbacks
doesn't throw when the uid and package name do not match.

Bug: 149119324
Test: atest FrameworksNetTests
Change-Id: Ie302b1f4f437e819fdd15ec28adb0b56750c2c53
This commit is contained in:
Cody Kesting
2020-03-05 13:10:44 -08:00
parent a84aee7ad3
commit 807ce6621b

View File

@@ -6770,15 +6770,11 @@ public class ConnectivityServiceTest {
mServiceContext.setPermission(android.Manifest.permission.NETWORK_STACK, PERMISSION_DENIED);
try {
assertFalse(
"Mismatched uid/package name should not pass the location permission check",
mService.checkConnectivityDiagnosticsPermissions(
Process.myPid() + 1, Process.myUid() + 1, naiWithoutUid,
mContext.getOpPackageName()));
} catch (SecurityException e) {
fail("checkConnectivityDiagnosticsPermissions shouldn't surface a SecurityException");
}
assertFalse(
"Mismatched uid/package name should not pass the location permission check",
mService.checkConnectivityDiagnosticsPermissions(
Process.myPid() + 1, Process.myUid() + 1, naiWithoutUid,
mContext.getOpPackageName()));
}
@Test