Fix PermissionMonitorTest that has been failing.

The fail is related to a recent fix to PermissionMonitor
that went into pi-dev only : ag/3799094, which fixed getting
the remote package name for the correct macro user instead of
the default. That fix had broken the test, this change fixes it.

Test: test now passes
Bug: 77315205
Change-Id: I26f8276eafe80478d5fefcff92e7dc2f12128bb4
This commit is contained in:
Chalard Jean
2018-04-02 16:16:46 +09:00
parent d197642ba8
commit 94de1787a4

View File

@@ -26,6 +26,8 @@ import static android.content.pm.PackageManager.GET_PERMISSIONS;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.anyInt;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.when;
import android.content.Context;
@@ -62,8 +64,8 @@ public class PermissionMonitorTest {
private void expectPermission(String[] permissions, boolean preinstalled) throws Exception {
final PackageInfo packageInfo = packageInfoWithPermissions(permissions, preinstalled);
when(mPackageManager.getPackageInfo(MOCK_PACKAGE_NAMES[0], GET_PERMISSIONS))
.thenReturn(packageInfo);
when(mPackageManager.getPackageInfoAsUser(
eq(MOCK_PACKAGE_NAMES[0]), eq(GET_PERMISSIONS), anyInt())).thenReturn(packageInfo);
}
private PackageInfo packageInfoWithPermissions(String[] permissions, boolean preinstalled) {