@Test public void testSchedule() throws InterruptedException { OneTimeWorkRequest work = new OneTimeWorkRequest.Builder(TestWorker.class) .setPeriodStartTime(System.currentTimeMillis(), TimeUnit.MILLISECONDS) .setInitialDelay(TimeUnit.HOURS.toMillis(1), TimeUnit.MILLISECONDS).build(); insertWork(work); String workSpecId = work.getStringId(); final Intent intent = CommandHandler.createScheduleWorkIntent(mContext, workSpecId); mSpyDispatcher.postOnMainThread( new SystemAlarmDispatcher.AddRunnable(mSpyDispatcher, intent, START_ID)); mLatch.await(TEST_TIMEOUT, TimeUnit.SECONDS); }
void postOnMainThread(@NonNull Runnable runnable) { mMainHandler.post(runnable); }
SystemAlarmDispatcher implements ExecutionListener { void postOnMainThread(@NonNull Runnable runnable) { mMainHandler.post(runnable); } }
SystemAlarmDispatcher implements ExecutionListener { void postOnMainThread(@NonNull Runnable runnable) { mMainHandler.post(runnable); } SystemAlarmDispatcher(@NonNull Context context); @VisibleForTesting  SystemAlarmDispatcher(
            @NonNull Context context,
            @Nullable Processor processor,
            @Nullable WorkManagerImpl workManager); }
SystemAlarmDispatcher implements ExecutionListener { void postOnMainThread(@NonNull Runnable runnable) { mMainHandler.post(runnable); } SystemAlarmDispatcher(@NonNull Context context); @VisibleForTesting  SystemAlarmDispatcher(
            @NonNull Context context,
            @Nullable Processor processor,
            @Nullable WorkManagerImpl workManager); @Override void onExecuted(
            @NonNull String workSpecId,
            boolean isSuccessful,
            boolean needsReschedule); @MainThread boolean add(@NonNull final Intent intent, final int startId); }
SystemAlarmDispatcher implements ExecutionListener { void postOnMainThread(@NonNull Runnable runnable) { mMainHandler.post(runnable); } SystemAlarmDispatcher(@NonNull Context context); @VisibleForTesting  SystemAlarmDispatcher(
            @NonNull Context context,
            @Nullable Processor processor,
            @Nullable WorkManagerImpl workManager); @Override void onExecuted(
            @NonNull String workSpecId,
            boolean isSuccessful,
            boolean needsReschedule); @MainThread boolean add(@NonNull final Intent intent, final int startId);  }