Search in sources :

Example 6 with Event

use of com.android.server.job.MockPriorityJobService.TestEnvironment.Event in project android_frameworks_base by crdroidandroid.

the class PrioritySchedulingTest method testHigherPriorityJobNotPreempted.

public void testHigherPriorityJobNotPreempted() throws Exception {
    JobInfo job1 = new JobInfo.Builder(111, kJobServiceComponent).setPriority(2).setOverrideDeadline(7000L).build();
    JobInfo job2 = new JobInfo.Builder(222, kJobServiceComponent).setPriority(2).setOverrideDeadline(7000L).build();
    JobInfo job3 = new JobInfo.Builder(333, kJobServiceComponent).setPriority(2).setOverrideDeadline(7000L).build();
    JobInfo job4 = new JobInfo.Builder(444, kJobServiceComponent).setPriority(1).setMinimumLatency(2000L).setOverrideDeadline(7000L).build();
    mJobScheduler.schedule(job1);
    mJobScheduler.schedule(job2);
    mJobScheduler.schedule(job3);
    mJobScheduler.schedule(job4);
    // Wait for job 4 to preempt one of the higher priority jobs
    Thread.sleep(10000);
    Event job4Execution = new Event(TestEnvironment.EVENT_START_JOB, 444);
    boolean wasJob4Executed = kTestEnvironment.getExecutedEvents().contains(job4Execution);
    assertFalse("Higher priority job was preempted.", wasJob4Executed);
}
Also used : JobInfo(android.app.job.JobInfo) Event(com.android.server.job.MockPriorityJobService.TestEnvironment.Event)

Example 7 with Event

use of com.android.server.job.MockPriorityJobService.TestEnvironment.Event in project android_frameworks_base by DirtyUnicorns.

the class PrioritySchedulingTest method testHigherPriorityJobNotPreempted.

public void testHigherPriorityJobNotPreempted() throws Exception {
    JobInfo job1 = new JobInfo.Builder(111, kJobServiceComponent).setPriority(2).setOverrideDeadline(7000L).build();
    JobInfo job2 = new JobInfo.Builder(222, kJobServiceComponent).setPriority(2).setOverrideDeadline(7000L).build();
    JobInfo job3 = new JobInfo.Builder(333, kJobServiceComponent).setPriority(2).setOverrideDeadline(7000L).build();
    JobInfo job4 = new JobInfo.Builder(444, kJobServiceComponent).setPriority(1).setMinimumLatency(2000L).setOverrideDeadline(7000L).build();
    mJobScheduler.schedule(job1);
    mJobScheduler.schedule(job2);
    mJobScheduler.schedule(job3);
    mJobScheduler.schedule(job4);
    // Wait for job 4 to preempt one of the higher priority jobs
    Thread.sleep(10000);
    Event job4Execution = new Event(TestEnvironment.EVENT_START_JOB, 444);
    boolean wasJob4Executed = kTestEnvironment.getExecutedEvents().contains(job4Execution);
    assertFalse("Higher priority job was preempted.", wasJob4Executed);
}
Also used : JobInfo(android.app.job.JobInfo) Event(com.android.server.job.MockPriorityJobService.TestEnvironment.Event)

Example 8 with Event

use of com.android.server.job.MockPriorityJobService.TestEnvironment.Event in project android_frameworks_base by ResurrectionRemix.

the class PrioritySchedulingTest method testHigherPriorityJobNotPreempted.

public void testHigherPriorityJobNotPreempted() throws Exception {
    JobInfo job1 = new JobInfo.Builder(111, kJobServiceComponent).setPriority(2).setOverrideDeadline(7000L).build();
    JobInfo job2 = new JobInfo.Builder(222, kJobServiceComponent).setPriority(2).setOverrideDeadline(7000L).build();
    JobInfo job3 = new JobInfo.Builder(333, kJobServiceComponent).setPriority(2).setOverrideDeadline(7000L).build();
    JobInfo job4 = new JobInfo.Builder(444, kJobServiceComponent).setPriority(1).setMinimumLatency(2000L).setOverrideDeadline(7000L).build();
    mJobScheduler.schedule(job1);
    mJobScheduler.schedule(job2);
    mJobScheduler.schedule(job3);
    mJobScheduler.schedule(job4);
    // Wait for job 4 to preempt one of the higher priority jobs
    Thread.sleep(10000);
    Event job4Execution = new Event(TestEnvironment.EVENT_START_JOB, 444);
    boolean wasJob4Executed = kTestEnvironment.getExecutedEvents().contains(job4Execution);
    assertFalse("Higher priority job was preempted.", wasJob4Executed);
}
Also used : JobInfo(android.app.job.JobInfo) Event(com.android.server.job.MockPriorityJobService.TestEnvironment.Event)

Aggregations

JobInfo (android.app.job.JobInfo)8 Event (com.android.server.job.MockPriorityJobService.TestEnvironment.Event)8