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/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 namespace content { | 68 namespace content { |
69 namespace { | 69 namespace { |
70 | 70 |
71 // FIXME: It would be great if there was a reusable mock SingleThreadTaskRunner | 71 // FIXME: It would be great if there was a reusable mock SingleThreadTaskRunner |
72 class TestTaskCounter : public base::SingleThreadTaskRunner { | 72 class TestTaskCounter : public base::SingleThreadTaskRunner { |
73 public: | 73 public: |
74 TestTaskCounter() : count_(0) {} | 74 TestTaskCounter() : count_(0) {} |
75 | 75 |
76 // SingleThreadTaskRunner implementation. | 76 // SingleThreadTaskRunner implementation. |
77 bool PostDelayedTask(const tracked_objects::Location&, | 77 bool PostDelayedTask(const tracked_objects::Location&, |
78 const base::Closure&, | 78 base::OnceClosure, |
79 base::TimeDelta) override { | 79 base::TimeDelta) override { |
80 base::AutoLock auto_lock(lock_); | 80 base::AutoLock auto_lock(lock_); |
81 count_++; | 81 count_++; |
82 return true; | 82 return true; |
83 } | 83 } |
84 | 84 |
85 bool PostNonNestableDelayedTask(const tracked_objects::Location&, | 85 bool PostNonNestableDelayedTask(const tracked_objects::Location&, |
86 const base::Closure&, | 86 base::OnceClosure, |
87 base::TimeDelta) override { | 87 base::TimeDelta) override { |
88 base::AutoLock auto_lock(lock_); | 88 base::AutoLock auto_lock(lock_); |
89 count_++; | 89 count_++; |
90 return true; | 90 return true; |
91 } | 91 } |
92 | 92 |
93 bool RunsTasksOnCurrentThread() const override { return true; } | 93 bool RunsTasksOnCurrentThread() const override { return true; } |
94 | 94 |
95 int NumTasksPosted() const { | 95 int NumTasksPosted() const { |
96 base::AutoLock auto_lock(lock_); | 96 base::AutoLock auto_lock(lock_); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 sender()->Send(new TestMsg_QuitRunLoop()); | 268 sender()->Send(new TestMsg_QuitRunLoop()); |
269 | 269 |
270 base::RunLoop().Run(); | 270 base::RunLoop().Run(); |
271 | 271 |
272 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); | 272 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); |
273 } | 273 } |
274 | 274 |
275 } // namespace | 275 } // namespace |
276 } // namespace content | 276 } // namespace content |
OLD | NEW |