@Test public void schedule_whenRunning_onStopIsCalled() { Bundle bundle = TestUtil.getBundleForContentJobExecution(); JobCoder prefixedCoder = new JobCoder(BundleProtocol.PACKED_PARAM_BUNDLE_PREFIX); JobInvocation invocation = prefixedCoder.decodeIntentBundle(bundle); googlePlayReceiver.prepareJob(jobCallbackMock, bundle); when(mMockContext.bindService( any(Intent.class), serviceConnectionCaptor.capture(), eq(BIND_AUTO_CREATE))) .thenReturn(true); new ExecutionDelegator(mMockContext, callbackMock, constraintCheckerMock) .executeJob(invocation); Job job = TestUtil.getBuilderWithNoopValidator() .setService(TestJobService.class) .setTrigger(invocation.getTrigger()) .setTag(invocation.getTag()) .build(); googlePlayDriver.schedule(job); verify(mMockContext).sendBroadcast(any(Intent.class)); assertTrue(serviceConnectionCaptor.getValue().wasUnbound()); assertNull( "JobServiceConnection should be removed.", ExecutionDelegator.getJobServiceConnection(invocation.getService())); }
@Override @ScheduleResult public int schedule(@NonNull Job job) { GooglePlayReceiver.onSchedule(job); context.sendBroadcast(createScheduleRequest(job)); return FirebaseJobDispatcher.SCHEDULE_RESULT_SUCCESS; }
GooglePlayDriver implements Driver { @Override @ScheduleResult public int schedule(@NonNull Job job) { GooglePlayReceiver.onSchedule(job); context.sendBroadcast(createScheduleRequest(job)); return FirebaseJobDispatcher.SCHEDULE_RESULT_SUCCESS; } }
GooglePlayDriver implements Driver { @Override @ScheduleResult public int schedule(@NonNull Job job) { GooglePlayReceiver.onSchedule(job); context.sendBroadcast(createScheduleRequest(job)); return FirebaseJobDispatcher.SCHEDULE_RESULT_SUCCESS; } GooglePlayDriver(@NonNull Context context); }
GooglePlayDriver implements Driver { @Override @ScheduleResult public int schedule(@NonNull Job job) { GooglePlayReceiver.onSchedule(job); context.sendBroadcast(createScheduleRequest(job)); return FirebaseJobDispatcher.SCHEDULE_RESULT_SUCCESS; } GooglePlayDriver(@NonNull Context context); @Override boolean isAvailable(); @Override @ScheduleResult int schedule(@NonNull Job job); @Override int cancel(@NonNull String tag); @Override int cancelAll(); @NonNull @Override JobValidator getValidator(); }
GooglePlayDriver implements Driver { @Override @ScheduleResult public int schedule(@NonNull Job job) { GooglePlayReceiver.onSchedule(job); context.sendBroadcast(createScheduleRequest(job)); return FirebaseJobDispatcher.SCHEDULE_RESULT_SUCCESS; } GooglePlayDriver(@NonNull Context context); @Override boolean isAvailable(); @Override @ScheduleResult int schedule(@NonNull Job job); @Override int cancel(@NonNull String tag); @Override int cancelAll(); @NonNull @Override JobValidator getValidator();  }