Chromium Code Reviews| Index: base/task/cancelable_task_tracker_unittest.cc |
| diff --git a/base/task/cancelable_task_tracker_unittest.cc b/base/task/cancelable_task_tracker_unittest.cc |
| index fd480f3687511a7fadbf13f5fc0f7014a9a5e7fe..c04165e296263877282ced55e4df7b7eadf915bd 100644 |
| --- a/base/task/cancelable_task_tracker_unittest.cc |
| +++ b/base/task/cancelable_task_tracker_unittest.cc |
| @@ -316,6 +316,29 @@ TEST_F(CancelableTaskTrackerTest, HasTrackedTasksPostWithReply) { |
| EXPECT_FALSE(task_tracker_.HasTrackedTasks()); |
| } |
| +// Post a task with a delay and cancel it. HasTrackedTasks() should return true |
| +// from when the task is posted until it is canceled. |
| +TEST_F(CancelableTaskTrackerTest, HasTrackedTasksPostDelayed) { |
|
Marc Treib
2017/02/02 10:52:21
I think there's a few more tests here that should
mastiz
2017/02/02 12:35:54
I added these but then rethought the whole approac
|
| + scoped_refptr<TestSimpleTaskRunner> test_task_runner( |
| + new TestSimpleTaskRunner()); |
| + |
| + EXPECT_FALSE(task_tracker_.HasTrackedTasks()); |
| + |
| + ignore_result(task_tracker_.PostDelayedTask( |
| + test_task_runner.get(), FROM_HERE, MakeExpectedNotRunClosure(FROM_HERE), |
| + base::TimeDelta::FromSeconds(1))); |
| + |
| + task_tracker_.TryCancelAll(); |
| + |
| + test_task_runner->RunUntilIdle(); |
| + |
| + EXPECT_TRUE(task_tracker_.HasTrackedTasks()); |
| + |
| + RunCurrentLoopUntilIdle(); |
| + |
| + EXPECT_FALSE(task_tracker_.HasTrackedTasks()); |
| +} |
| + |
| // Create a new tracked task ID. HasTrackedTasks() should return true |
| // until the IsCanceledCallback is destroyed. |
| TEST_F(CancelableTaskTrackerTest, HasTrackedTasksIsCancelled) { |