use of android.app.job.JobParameters in project android-priority-jobqueue by yigit.
the class FrameworkJobSchedulerServiceTest method onStopJob.
@Test
public void onStopJob() {
JobParameters params = mock(JobParameters.class);
service.onStopJob(params);
verify(mockScheduler).onStopJob(params);
}
use of android.app.job.JobParameters in project android-priority-jobqueue by yigit.
the class FrameworkSchedulerTest method triggerOnStart.
private SchedulerConstraint triggerOnStart(SchedulerConstraint constraint, JobParameters[] outParams) {
ArgumentCaptor<SchedulerConstraint> constraintCaptor = ArgumentCaptor.forClass(SchedulerConstraint.class);
when(mockCallback.start(constraintCaptor.capture())).thenReturn(true);
JobParameters params = prepareJobParameters(constraint);
outParams[0] = params;
fwScheduler.onStartJob(params);
verify(mockCallback).start(Mockito.any(SchedulerConstraint.class));
return constraintCaptor.getValue();
}
use of android.app.job.JobParameters in project android-priority-jobqueue by yigit.
the class FrameworkSchedulerTest method badBundleOnStop.
@Test
public void badBundleOnStop() {
// see https://github.com/yigit/android-priority-jobqueue/issues/254
JobParameters params = mock(JobParameters.class);
PersistableBundle badBundle = mock(PersistableBundle.class);
when(badBundle.getString(anyString(), anyString())).thenThrow(new NullPointerException());
when(badBundle.getString(anyString())).thenThrow(new NullPointerException());
assertThat(fwScheduler.onStopJob(params), is(false));
}
use of android.app.job.JobParameters in project android-priority-jobqueue by yigit.
the class FrameworkSchedulerTest method badBundleOnStart.
@Test
public void badBundleOnStart() {
// see https://github.com/yigit/android-priority-jobqueue/issues/254
JobParameters params = mock(JobParameters.class);
PersistableBundle badBundle = mock(PersistableBundle.class);
when(badBundle.getString(anyString(), anyString())).thenThrow(new NullPointerException());
when(badBundle.getString(anyString())).thenThrow(new NullPointerException());
assertThat(fwScheduler.onStartJob(params), is(false));
}
use of android.app.job.JobParameters in project android_frameworks_base by ResurrectionRemix.
the class SyncJobService method callJobFinished.
public void callJobFinished(int jobId, boolean needsReschedule) {
synchronized (jobParamsMap) {
JobParameters params = jobParamsMap.get(jobId);
if (params != null) {
jobFinished(params, needsReschedule);
jobParamsMap.remove(jobId);
} else {
Slog.e(TAG, "Job params not found for " + String.valueOf(jobId));
}
}
}
Aggregations