use of org.robolectric.shadows.ShadowApplication.Wrapper in project robolectric by robolectric.
the class ShadowInstrumentation method sendOrderedBroadcastAsUser.
void sendOrderedBroadcastAsUser(Intent intent, UserHandle userHandle, String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras, Context context) {
List<Wrapper> receivers = getAppropriateWrappers(context, userHandle, intent, receiverPermission, /* broadcastOptions= */
null);
sortByPriority(receivers);
if (resultReceiver != null) {
receivers.add(new Wrapper(resultReceiver, null, context, null, scheduler));
}
postOrderedToWrappers(receivers, intent, initialCode, initialData, initialExtras, context);
}
use of org.robolectric.shadows.ShadowApplication.Wrapper in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class TetherServiceTest method scheduleAlarm_shouldRegisterReceiver.
@Test
public void scheduleAlarm_shouldRegisterReceiver() {
mService.setHotspotOffReceiver(new HotspotOffReceiver(mAppContext));
mService.scheduleAlarm();
boolean found = false;
for (Wrapper wrapper : ShadowApplication.getInstance().getRegisteredReceivers()) {
if (wrapper.intentFilter.matchAction(WifiManager.WIFI_AP_STATE_CHANGED_ACTION)) {
found = true;
break;
}
}
assertThat(found).isTrue();
}
Aggregations