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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 BackgroundTaskSchedulerPrefs.removeScheduledTask(TASK_1.getTaskId()); | 79 BackgroundTaskSchedulerPrefs.removeScheduledTask(TASK_1.getTaskId()); |
80 assertEquals("Removing a task which is not there does not affect the tas
k set.", 1, | 80 assertEquals("Removing a task which is not there does not affect the tas
k set.", 1, |
81 BackgroundTaskSchedulerPrefs.getScheduledTasks().size()); | 81 BackgroundTaskSchedulerPrefs.getScheduledTasks().size()); |
82 | 82 |
83 Set<String> scheduledTasks = BackgroundTaskSchedulerPrefs.getScheduledTa
sks(); | 83 Set<String> scheduledTasks = BackgroundTaskSchedulerPrefs.getScheduledTa
sks(); |
84 assertFalse("TASK_1 class name in scheduled tasks.", | 84 assertFalse("TASK_1 class name in scheduled tasks.", |
85 scheduledTasks.contains(TASK_1.getBackgroundTaskClass().getName(
))); | 85 scheduledTasks.contains(TASK_1.getBackgroundTaskClass().getName(
))); |
86 assertTrue("TASK_2 class name in scheduled tasks.", | 86 assertTrue("TASK_2 class name in scheduled tasks.", |
87 scheduledTasks.contains(TASK_2.getBackgroundTaskClass().getName(
))); | 87 scheduledTasks.contains(TASK_2.getBackgroundTaskClass().getName(
))); |
88 } | 88 } |
| 89 |
| 90 @Test |
| 91 @Feature("BackgroundTaskScheduler") |
| 92 public void testRemoveAllTasks() { |
| 93 BackgroundTaskSchedulerPrefs.addScheduledTask(TASK_1); |
| 94 BackgroundTaskSchedulerPrefs.addScheduledTask(TASK_2); |
| 95 BackgroundTaskSchedulerPrefs.removeAllTasks(); |
| 96 assertTrue("We are expecting a all tasks to be gone.", |
| 97 BackgroundTaskSchedulerPrefs.getScheduledTasks().isEmpty()); |
| 98 } |
89 } | 99 } |
OLD | NEW |