Add test to verify PackageMonitorCallbackHelper for user removal
Bug: 29385425 Test: atest PackageMonitorCallbackHelperTest --iterations 100 Change-Id: I977cd1b7b425a6258bb7aa5f762b3ca9cc2619c0
This commit is contained in:
@@ -221,6 +221,19 @@ public class PackageMonitorCallbackHelperTest {
|
||||
assertThat(pkgNames[0]).isEqualTo(FAKE_PACKAGE_NAME);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPackageMonitorCallback_onUserRemoved_callbackNotCalled() throws Exception {
|
||||
IRemoteCallback callback = createMockPackageMonitorCallback();
|
||||
mPackageMonitorCallbackHelper.registerPackageMonitorCallback(callback, 10 /* userId */);
|
||||
|
||||
mPackageMonitorCallbackHelper.onUserRemoved(10);
|
||||
mPackageMonitorCallbackHelper.notifyPackageMonitor(Intent.ACTION_PACKAGE_ADDED,
|
||||
FAKE_PACKAGE_NAME, createFakeBundle(), new int[]{10} /* userIds */,
|
||||
null /* instantUserIds */);
|
||||
|
||||
verify(callback, after(WAIT_CALLBACK_CALLED_IN_MS).never()).sendResult(any());
|
||||
}
|
||||
|
||||
private IRemoteCallback createMockPackageMonitorCallback() {
|
||||
return spy(new IRemoteCallback.Stub() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user