Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2290)

Unified Diff: cc/base/delayed_unique_notifier_unittest.cc

Issue 2434783002: Use OnceClosure in TestPendingTask (Closed)
Patch Set: +comment Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/test/test_simple_task_runner.cc ('k') | cc/test/ordered_simple_task_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ae9ad17e9972d9c2dc4d314c86edc62ba2627891..5f5f50b56834f2161628c5efdcf07cbe3cb346df 100644
--- a/cc/base/delayed_unique_notifier_unittest.cc
+++ b/cc/base/delayed_unique_notifier_unittest.cc
@@ -73,7 +73,7 @@ TEST_F(DelayedUniqueNotifierTest, ZeroDelay) {
ASSERT_EQ(1u, tasks.size());
EXPECT_EQ(base::TimeTicks() + delay, tasks[0].GetTimeToRun());
- tasks[0].task.Run();
+ std::move(tasks[0].task).Run();
EXPECT_EQ(1, NotificationCount());
// 5 schedules should result in only one run.
@@ -84,7 +84,7 @@ TEST_F(DelayedUniqueNotifierTest, ZeroDelay) {
ASSERT_EQ(1u, tasks.size());
EXPECT_EQ(base::TimeTicks() + delay, tasks[0].GetTimeToRun());
- tasks[0].task.Run();
+ std::move(tasks[0].task).Run();
EXPECT_EQ(2, NotificationCount());
}
@@ -110,7 +110,7 @@ TEST_F(DelayedUniqueNotifierTest, SmallDelay) {
EXPECT_EQ(base::TimeTicks() + delay, tasks[0].GetTimeToRun());
// It's not yet time to run, so we expect no notifications.
- tasks[0].task.Run();
+ std::move(tasks[0].task).Run();
EXPECT_EQ(0, NotificationCount());
tasks = TakePendingTasks();
@@ -127,7 +127,7 @@ TEST_F(DelayedUniqueNotifierTest, SmallDelay) {
notifier.SetNow(notifier.Now() + base::TimeDelta::FromInternalValue(19));
// It's not yet time to run, so we expect no notifications.
- tasks[0].task.Run();
+ std::move(tasks[0].task).Run();
EXPECT_EQ(0, NotificationCount());
tasks = TakePendingTasks();
@@ -141,7 +141,7 @@ TEST_F(DelayedUniqueNotifierTest, SmallDelay) {
notifier.SetNow(notifier.Now() + base::TimeDelta::FromInternalValue(1));
// It's time to run!
- tasks[0].task.Run();
+ std::move(tasks[0].task).Run();
EXPECT_EQ(1, NotificationCount());
tasks = TakePendingTasks();
@@ -172,7 +172,7 @@ TEST_F(DelayedUniqueNotifierTest, RescheduleDelay) {
EXPECT_EQ(base::TimeTicks() + delay, tasks[0].GetTimeToRun());
// It's not yet time to run, so we expect no notifications.
- tasks[0].task.Run();
+ std::move(tasks[0].task).Run();
EXPECT_EQ(0, NotificationCount());
}
@@ -186,7 +186,7 @@ TEST_F(DelayedUniqueNotifierTest, RescheduleDelay) {
EXPECT_EQ(base::TimeTicks() + delay, tasks[0].GetTimeToRun());
// Time to run!
- tasks[0].task.Run();
+ std::move(tasks[0].task).Run();
EXPECT_EQ(1, NotificationCount());
}
@@ -216,7 +216,7 @@ TEST_F(DelayedUniqueNotifierTest, CancelAndHasPendingNotification) {
EXPECT_EQ(base::TimeTicks() + delay, tasks[0].GetTimeToRun());
// Time to run, but a canceled task!
- tasks[0].task.Run();
+ std::move(tasks[0].task).Run();
EXPECT_EQ(0, NotificationCount());
EXPECT_FALSE(notifier.HasPendingNotification());
@@ -234,7 +234,7 @@ TEST_F(DelayedUniqueNotifierTest, CancelAndHasPendingNotification) {
notifier.SetNow(notifier.Now() + delay);
// This should run since it wasn't canceled.
- tasks[0].task.Run();
+ std::move(tasks[0].task).Run();
EXPECT_EQ(1, NotificationCount());
EXPECT_FALSE(notifier.HasPendingNotification());
@@ -252,7 +252,7 @@ TEST_F(DelayedUniqueNotifierTest, CancelAndHasPendingNotification) {
// Time to run, but a canceled task!
notifier.SetNow(notifier.Now() + delay);
- tasks[0].task.Run();
+ std::move(tasks[0].task).Run();
EXPECT_EQ(1, NotificationCount());
tasks = TakePendingTasks();
@@ -284,7 +284,7 @@ TEST_F(DelayedUniqueNotifierTest, ShutdownWithScheduledTask) {
ASSERT_EQ(1u, tasks.size());
// Running the task after shutdown does nothing since it's cancelled.
- tasks[0].task.Run();
+ std::move(tasks[0].task).Run();
EXPECT_EQ(0, NotificationCount());
tasks = TakePendingTasks();
« no previous file with comments | « base/test/test_simple_task_runner.cc ('k') | cc/test/ordered_simple_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698