From 974712839437ee30939369e96291b197fe7502b0 Mon Sep 17 00:00:00 2001 From: Kweku Adams Date: Wed, 19 Jan 2022 17:44:51 +0000 Subject: [PATCH] Fix prefetch test. Confirm that the PrefetchController has processed the launch time change and scheduled an alarm before checking that the JobStatus has been updated. Bug: 215215283 Test: atest --rerun-until-failure 50 FrameworksMockingServicesTests:PrefetchControllerTest Change-Id: I99a3298e6ae05819e7da18b9658e71969e8f9647 --- .../server/job/controllers/PrefetchControllerTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/tests/mockingservicestests/src/com/android/server/job/controllers/PrefetchControllerTest.java b/services/tests/mockingservicestests/src/com/android/server/job/controllers/PrefetchControllerTest.java index d7414591f83c7..8a954caad939a 100644 --- a/services/tests/mockingservicestests/src/com/android/server/job/controllers/PrefetchControllerTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/job/controllers/PrefetchControllerTest.java @@ -383,6 +383,10 @@ public class PrefetchControllerTest { inOrder.verify(mUsageStatsManagerInternal, timeout(DEFAULT_WAIT_MS).times(0)) .getEstimatedPackageLaunchTime(SOURCE_PACKAGE, SOURCE_USER_ID); + verify(mAlarmManager, timeout(DEFAULT_WAIT_MS).times(1)) + .setWindow( + anyInt(), eq(sElapsedRealtimeClock.millis() + 3 * HOUR_IN_MILLIS), + anyLong(), eq(TAG_PREFETCH), any(), any()); assertFalse(jobStatus.isConstraintSatisfied(JobStatus.CONSTRAINT_PREFETCH)); }