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 Merged-In: Ie302b1f4f437e819fdd15ec28adb0b56750c2c53 (cherry picked from commit 66b5e081b785a3b7e2a032342d4d424905581cf9)
This commit is contained in:
committed by
Cody Kesting
parent
cf7bb0ee06
commit
21105c9771
@@ -6810,15 +6810,11 @@ public class ConnectivityServiceTest {
|
|||||||
|
|
||||||
mServiceContext.setPermission(android.Manifest.permission.NETWORK_STACK, PERMISSION_DENIED);
|
mServiceContext.setPermission(android.Manifest.permission.NETWORK_STACK, PERMISSION_DENIED);
|
||||||
|
|
||||||
try {
|
assertFalse(
|
||||||
assertFalse(
|
"Mismatched uid/package name should not pass the location permission check",
|
||||||
"Mismatched uid/package name should not pass the location permission check",
|
mService.checkConnectivityDiagnosticsPermissions(
|
||||||
mService.checkConnectivityDiagnosticsPermissions(
|
Process.myPid() + 1, Process.myUid() + 1, naiWithoutUid,
|
||||||
Process.myPid() + 1, Process.myUid() + 1, naiWithoutUid,
|
mContext.getOpPackageName()));
|
||||||
mContext.getOpPackageName()));
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
fail("checkConnectivityDiagnosticsPermissions shouldn't surface a SecurityException");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user