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

Unified Diff: base/run_loop_unittest.cc

Issue 2791243002: Rewrite base::Bind into base::BindOnce on trivial cases in base (Closed)
Patch Set: rebase Created 3 years, 8 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/process/process_metrics_unittest.cc ('k') | base/sequence_checker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/run_loop_unittest.cc
diff --git a/base/run_loop_unittest.cc b/base/run_loop_unittest.cc
index a87ced09885f041a148f04c639620fec4e58aea3..5be97d4a7d0abb6b86b0579df4253599cd157f87 100644
--- a/base/run_loop_unittest.cc
+++ b/base/run_loop_unittest.cc
@@ -35,11 +35,11 @@ void RunNestedLoopTask(int* counter) {
// This task should quit |nested_run_loop| but not the main RunLoop.
ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, Bind(&QuitWhenIdleTask, Unretained(&nested_run_loop),
- Unretained(counter)));
+ FROM_HERE, BindOnce(&QuitWhenIdleTask, Unretained(&nested_run_loop),
+ Unretained(counter)));
ThreadTaskRunnerHandle::Get()->PostDelayedTask(
- FROM_HERE, Bind(&ShouldNotRunTask), TimeDelta::FromDays(1));
+ FROM_HERE, BindOnce(&ShouldNotRunTask), TimeDelta::FromDays(1));
MessageLoop::ScopedNestableTaskAllower allower(MessageLoop::current());
nested_run_loop.Run();
@@ -63,12 +63,12 @@ class RunLoopTest : public testing::Test {
TEST_F(RunLoopTest, QuitWhenIdle) {
message_loop_.task_runner()->PostTask(
- FROM_HERE,
- Bind(&QuitWhenIdleTask, Unretained(&run_loop_), Unretained(&counter_)));
+ FROM_HERE, BindOnce(&QuitWhenIdleTask, Unretained(&run_loop_),
+ Unretained(&counter_)));
message_loop_.task_runner()->PostTask(
- FROM_HERE, Bind(&ShouldRunTask, Unretained(&counter_)));
+ FROM_HERE, BindOnce(&ShouldRunTask, Unretained(&counter_)));
message_loop_.task_runner()->PostDelayedTask(
- FROM_HERE, Bind(&ShouldNotRunTask), TimeDelta::FromDays(1));
+ FROM_HERE, BindOnce(&ShouldNotRunTask), TimeDelta::FromDays(1));
run_loop_.Run();
EXPECT_EQ(2, counter_);
@@ -76,14 +76,14 @@ TEST_F(RunLoopTest, QuitWhenIdle) {
TEST_F(RunLoopTest, QuitWhenIdleNestedLoop) {
message_loop_.task_runner()->PostTask(
- FROM_HERE, Bind(&RunNestedLoopTask, Unretained(&counter_)));
+ FROM_HERE, BindOnce(&RunNestedLoopTask, Unretained(&counter_)));
message_loop_.task_runner()->PostTask(
- FROM_HERE,
- Bind(&QuitWhenIdleTask, Unretained(&run_loop_), Unretained(&counter_)));
+ FROM_HERE, BindOnce(&QuitWhenIdleTask, Unretained(&run_loop_),
+ Unretained(&counter_)));
message_loop_.task_runner()->PostTask(
- FROM_HERE, Bind(&ShouldRunTask, Unretained(&counter_)));
+ FROM_HERE, BindOnce(&ShouldRunTask, Unretained(&counter_)));
message_loop_.task_runner()->PostDelayedTask(
- FROM_HERE, Bind(&ShouldNotRunTask), TimeDelta::FromDays(1));
+ FROM_HERE, BindOnce(&ShouldNotRunTask), TimeDelta::FromDays(1));
run_loop_.Run();
EXPECT_EQ(4, counter_);
@@ -93,9 +93,9 @@ TEST_F(RunLoopTest, QuitWhenIdleClosure) {
message_loop_.task_runner()->PostTask(FROM_HERE,
run_loop_.QuitWhenIdleClosure());
message_loop_.task_runner()->PostTask(
- FROM_HERE, Bind(&ShouldRunTask, Unretained(&counter_)));
+ FROM_HERE, BindOnce(&ShouldRunTask, Unretained(&counter_)));
message_loop_.task_runner()->PostDelayedTask(
- FROM_HERE, Bind(&ShouldNotRunTask), TimeDelta::FromDays(1));
+ FROM_HERE, BindOnce(&ShouldNotRunTask), TimeDelta::FromDays(1));
run_loop_.Run();
EXPECT_EQ(1, counter_);
« no previous file with comments | « base/process/process_metrics_unittest.cc ('k') | base/sequence_checker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698