| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.components.background_task_scheduler; | 5 package org.chromium.components.background_task_scheduler; |
| 6 | 6 |
| 7 import static org.junit.Assert.assertEquals; | 7 import static org.junit.Assert.assertEquals; |
| 8 import static org.junit.Assert.assertFalse; | 8 import static org.junit.Assert.assertFalse; |
| 9 import static org.junit.Assert.assertTrue; | 9 import static org.junit.Assert.assertTrue; |
| 10 | 10 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 BackgroundTaskSchedulerPrefs.removeScheduledTask(TASK_1.getTaskId()); | 89 BackgroundTaskSchedulerPrefs.removeScheduledTask(TASK_1.getTaskId()); |
| 90 assertEquals("Removing a task which is not there does not affect the tas
k set.", 1, | 90 assertEquals("Removing a task which is not there does not affect the tas
k set.", 1, |
| 91 BackgroundTaskSchedulerPrefs.getScheduledTasks().size()); | 91 BackgroundTaskSchedulerPrefs.getScheduledTasks().size()); |
| 92 | 92 |
| 93 Set<String> scheduledTasks = BackgroundTaskSchedulerPrefs.getScheduledTa
sks(); | 93 Set<String> scheduledTasks = BackgroundTaskSchedulerPrefs.getScheduledTa
sks(); |
| 94 assertFalse("TASK_1 class name in scheduled tasks.", | 94 assertFalse("TASK_1 class name in scheduled tasks.", |
| 95 scheduledTasks.contains(TASK_1.getBackgroundTaskClass().getName(
))); | 95 scheduledTasks.contains(TASK_1.getBackgroundTaskClass().getName(
))); |
| 96 assertTrue("TASK_2 class name in scheduled tasks.", | 96 assertTrue("TASK_2 class name in scheduled tasks.", |
| 97 scheduledTasks.contains(TASK_2.getBackgroundTaskClass().getName(
))); | 97 scheduledTasks.contains(TASK_2.getBackgroundTaskClass().getName(
))); |
| 98 } | 98 } |
| 99 |
| 100 @Test |
| 101 @Feature("BackgroundTaskScheduler") |
| 102 public void testRemoveAllTasks() { |
| 103 BackgroundTaskSchedulerPrefs.addScheduledTask(TASK_1); |
| 104 BackgroundTaskSchedulerPrefs.addScheduledTask(TASK_2); |
| 105 BackgroundTaskSchedulerPrefs.removeAllTasks(); |
| 106 assertTrue("We are expecting a all tasks to be gone.", |
| 107 BackgroundTaskSchedulerPrefs.getScheduledTasks().isEmpty()); |
| 108 } |
| 99 } | 109 } |
| OLD | NEW |