OLD | NEW |
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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 bool PostDelayedTask(const tracked_objects::Location& location, | 99 bool PostDelayedTask(const tracked_objects::Location& location, |
100 const Closure& closure, | 100 const Closure& closure, |
101 base::TimeDelta delta) override { | 101 base::TimeDelta delta) override { |
102 return mock_->PostDelayedTask(location, closure, delta); | 102 return mock_->PostDelayedTask(location, closure, delta); |
103 } | 103 } |
104 bool PostNonNestableDelayedTask(const tracked_objects::Location& location, | 104 bool PostNonNestableDelayedTask(const tracked_objects::Location& location, |
105 const Closure& closure, | 105 const Closure& closure, |
106 base::TimeDelta delta) override { | 106 base::TimeDelta delta) override { |
107 return mock_->PostNonNestableDelayedTask(location, closure, delta); | 107 return mock_->PostNonNestableDelayedTask(location, closure, delta); |
108 } | 108 } |
| 109 std::string GetThreadName() const override { return std::string(); } |
109 | 110 |
110 private: | 111 private: |
111 MockTaskRunner* mock_; | 112 MockTaskRunner* mock_; |
112 ~TaskRunnerProxy() override {} | 113 ~TaskRunnerProxy() override {} |
113 }; | 114 }; |
114 | 115 |
115 TEST_F(StartupTaskRunnerTest, SynchronousExecution) { | 116 TEST_F(StartupTaskRunnerTest, SynchronousExecution) { |
116 MockTaskRunner mock_runner; | 117 MockTaskRunner mock_runner; |
117 scoped_refptr<TaskRunnerProxy> proxy = new TaskRunnerProxy(&mock_runner); | 118 scoped_refptr<TaskRunnerProxy> proxy = new TaskRunnerProxy(&mock_runner); |
118 | 119 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 EXPECT_EQ(observer_calls, 1); | 311 EXPECT_EQ(observer_calls, 1); |
311 EXPECT_EQ(observer_result, 1); | 312 EXPECT_EQ(observer_result, 1); |
312 | 313 |
313 // Check that running synchronously now doesn't do anything | 314 // Check that running synchronously now doesn't do anything |
314 runner.RunAllTasksNow(); | 315 runner.RunAllTasksNow(); |
315 EXPECT_EQ(observer_calls, 1); | 316 EXPECT_EQ(observer_calls, 1); |
316 EXPECT_EQ(task_count, 1); | 317 EXPECT_EQ(task_count, 1); |
317 } | 318 } |
318 } // namespace | 319 } // namespace |
319 } // namespace content | 320 } // namespace content |
OLD | NEW |