Chromium Code Reviews| Index: cc/base/delayed_unique_notifier_unittest.cc |
| diff --git a/cc/base/delayed_unique_notifier_unittest.cc b/cc/base/delayed_unique_notifier_unittest.cc |
| index 113146a082cbb58a4da62902d13382428a87f2da..a2dd273b9109c3aa3a822795acce54452331b5e9 100644 |
| --- a/cc/base/delayed_unique_notifier_unittest.cc |
| +++ b/cc/base/delayed_unique_notifier_unittest.cc |
| @@ -192,7 +192,7 @@ TEST_F(DelayedUniqueNotifierTest, RescheduleDelay) { |
| EXPECT_EQ(1, NotificationCount()); |
| } |
| -TEST_F(DelayedUniqueNotifierTest, Cancel) { |
| +TEST_F(DelayedUniqueNotifierTest, CancelAndHasPendingNotification) { |
| base::TimeDelta delay = base::TimeDelta::FromInternalValue(20); |
| TestNotifier notifier( |
| task_runner_, |
| @@ -206,9 +206,11 @@ TEST_F(DelayedUniqueNotifierTest, Cancel) { |
| notifier.Now() + base::TimeDelta::FromInternalValue(10); |
| notifier.SetNow(schedule_time); |
| notifier.Schedule(); |
| + EXPECT_TRUE(notifier.HasPendingNotification()); |
| // Cancel the run. |
| notifier.Cancel(); |
| + EXPECT_FALSE(notifier.HasPendingNotification()); |
| std::deque<base::TestPendingTask> tasks = TakePendingTasks(); |
| @@ -218,11 +220,13 @@ TEST_F(DelayedUniqueNotifierTest, Cancel) { |
| // Time to run, but a canceled task! |
| tasks[0].task.Run(); |
| EXPECT_EQ(0, NotificationCount()); |
| + EXPECT_FALSE(notifier.HasPendingNotification()); |
| tasks = TakePendingTasks(); |
| EXPECT_EQ(0u, tasks.size()); |
| notifier.Schedule(); |
| + EXPECT_TRUE(notifier.HasPendingNotification()); |
| tasks = TakePendingTasks(); |
| ASSERT_EQ(1u, tasks.size()); |
| @@ -234,11 +238,14 @@ TEST_F(DelayedUniqueNotifierTest, Cancel) { |
| // This should run since it wasn't scheduled. |
| tasks[0].task.Run(); |
| EXPECT_EQ(1, NotificationCount()); |
| + EXPECT_FALSE(notifier.HasPendingNotification()); |
| for (int i = 0; i < 10; ++i) |
| notifier.Schedule(); |
| + EXPECT_TRUE(notifier.HasPendingNotification()); |
| notifier.Cancel(); |
|
reveman
2014/05/30 00:19:28
While here, can you move this Cancel() call to the
vmpstr
2014/05/30 00:38:34
Done.
|
| + EXPECT_FALSE(notifier.HasPendingNotification()); |
| tasks = TakePendingTasks(); |
| ASSERT_EQ(1u, tasks.size()); |
| @@ -251,6 +258,7 @@ TEST_F(DelayedUniqueNotifierTest, Cancel) { |
| tasks = TakePendingTasks(); |
| EXPECT_EQ(0u, tasks.size()); |
| + EXPECT_FALSE(notifier.HasPendingNotification()); |
| } |
| } // namespace |