Update test on calling getAppExclusionList with restricted user
Bug: 247344442 Test: atest VpnTest Change-Id: I3b847f13162f8702013b23cabefce8d98b62f5c6
This commit is contained in:
@@ -944,12 +944,15 @@ public class VpnTest extends VpnTestBase {
|
|||||||
@Test
|
@Test
|
||||||
public void testSetAndGetAppExclusionListRestrictedUser() throws Exception {
|
public void testSetAndGetAppExclusionListRestrictedUser() throws Exception {
|
||||||
final Vpn vpn = prepareVpnForVerifyAppExclusionList();
|
final Vpn vpn = prepareVpnForVerifyAppExclusionList();
|
||||||
|
|
||||||
// Mock it to restricted profile
|
// Mock it to restricted profile
|
||||||
when(mUserManager.getUserInfo(anyInt())).thenReturn(RESTRICTED_PROFILE_A);
|
when(mUserManager.getUserInfo(anyInt())).thenReturn(RESTRICTED_PROFILE_A);
|
||||||
|
|
||||||
// Restricted users cannot configure VPNs
|
// Restricted users cannot configure VPNs
|
||||||
assertThrows(SecurityException.class,
|
assertThrows(SecurityException.class,
|
||||||
() -> vpn.setAppExclusionList(TEST_VPN_PKG, new ArrayList<>()));
|
() -> vpn.setAppExclusionList(TEST_VPN_PKG, new ArrayList<>()));
|
||||||
assertThrows(SecurityException.class, () -> vpn.getAppExclusionList(TEST_VPN_PKG));
|
|
||||||
|
assertEquals(Arrays.asList(PKGS), vpn.getAppExclusionList(TEST_VPN_PKG));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user