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

Side by Side Diff: content/browser/startup_task_runner_unittest.cc

Issue 2823103003: Introduce TaskRunner::RunsTasksInCurrentSequence() (Closed)
Patch Set: rebase & remove inline keyword Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/browser/startup_task_runner.h" 5 #include "content/browser/startup_task_runner.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 public: 79 public:
80 MOCK_METHOD2(PostDelayedTask, 80 MOCK_METHOD2(PostDelayedTask,
81 bool(const tracked_objects::Location&, base::TimeDelta)); 81 bool(const tracked_objects::Location&, base::TimeDelta));
82 MOCK_METHOD2(PostNonNestableDelayedTask, 82 MOCK_METHOD2(PostNonNestableDelayedTask,
83 bool(const tracked_objects::Location&, base::TimeDelta)); 83 bool(const tracked_objects::Location&, base::TimeDelta));
84 }; 84 };
85 85
86 class TaskRunnerProxy : public base::SingleThreadTaskRunner { 86 class TaskRunnerProxy : public base::SingleThreadTaskRunner {
87 public: 87 public:
88 TaskRunnerProxy(MockTaskRunner* mock) : mock_(mock) {} 88 TaskRunnerProxy(MockTaskRunner* mock) : mock_(mock) {}
89 bool RunsTasksOnCurrentThread() const override { return true; } 89 bool RunsTasksInCurrentSequence() const override { return true; }
90 bool PostDelayedTask(const tracked_objects::Location& location, 90 bool PostDelayedTask(const tracked_objects::Location& location,
91 base::OnceClosure closure, 91 base::OnceClosure closure,
92 base::TimeDelta delta) override { 92 base::TimeDelta delta) override {
93 last_task_ = std::move(closure); 93 last_task_ = std::move(closure);
94 return mock_->PostDelayedTask(location, delta); 94 return mock_->PostDelayedTask(location, delta);
95 } 95 }
96 bool PostNonNestableDelayedTask(const tracked_objects::Location& location, 96 bool PostNonNestableDelayedTask(const tracked_objects::Location& location,
97 base::OnceClosure closure, 97 base::OnceClosure closure,
98 base::TimeDelta delta) override { 98 base::TimeDelta delta) override {
99 last_task_ = std::move(closure); 99 last_task_ = std::move(closure);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 EXPECT_EQ(observer_calls, 1); 304 EXPECT_EQ(observer_calls, 1);
305 EXPECT_EQ(observer_result, 1); 305 EXPECT_EQ(observer_result, 1);
306 306
307 // Check that running synchronously now doesn't do anything 307 // Check that running synchronously now doesn't do anything
308 runner.RunAllTasksNow(); 308 runner.RunAllTasksNow();
309 EXPECT_EQ(observer_calls, 1); 309 EXPECT_EQ(observer_calls, 1);
310 EXPECT_EQ(task_count, 1); 310 EXPECT_EQ(task_count, 1);
311 } 311 }
312 } // namespace 312 } // namespace
313 } // namespace content 313 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698