OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <deque> | 5 #include <deque> |
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/test/test_pending_task.h" | 9 #include "base/test/test_pending_task.h" |
10 #include "base/test/test_simple_task_runner.h" | 10 #include "base/test/test_simple_task_runner.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 void SetNow(base::TimeTicks now) { now_ = now; } | 28 void SetNow(base::TimeTicks now) { now_ = now; } |
29 | 29 |
30 private: | 30 private: |
31 base::TimeTicks now_; | 31 base::TimeTicks now_; |
32 }; | 32 }; |
33 | 33 |
34 class DelayedUniqueNotifierTest : public testing::Test { | 34 class DelayedUniqueNotifierTest : public testing::Test { |
35 public: | 35 public: |
36 DelayedUniqueNotifierTest() : notification_count_(0) {} | 36 DelayedUniqueNotifierTest() : notification_count_(0) {} |
37 | 37 |
38 virtual void SetUp() override { | 38 void SetUp() override { |
39 notification_count_ = 0; | 39 notification_count_ = 0; |
40 task_runner_ = make_scoped_refptr(new base::TestSimpleTaskRunner); | 40 task_runner_ = make_scoped_refptr(new base::TestSimpleTaskRunner); |
41 } | 41 } |
42 | 42 |
43 void Notify() { ++notification_count_; } | 43 void Notify() { ++notification_count_; } |
44 | 44 |
45 int NotificationCount() const { return notification_count_; } | 45 int NotificationCount() const { return notification_count_; } |
46 | 46 |
47 std::deque<base::TestPendingTask> TakePendingTasks() { | 47 std::deque<base::TestPendingTask> TakePendingTasks() { |
48 std::deque<base::TestPendingTask> tasks = task_runner_->GetPendingTasks(); | 48 std::deque<base::TestPendingTask> tasks = task_runner_->GetPendingTasks(); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 ASSERT_EQ(0u, tasks.size()); | 326 ASSERT_EQ(0u, tasks.size()); |
327 | 327 |
328 // Verify after the scheduled time happens there is still no task. | 328 // Verify after the scheduled time happens there is still no task. |
329 notifier.SetNow(notifier.Now() + delay); | 329 notifier.SetNow(notifier.Now() + delay); |
330 tasks = TakePendingTasks(); | 330 tasks = TakePendingTasks(); |
331 ASSERT_EQ(0u, tasks.size()); | 331 ASSERT_EQ(0u, tasks.size()); |
332 } | 332 } |
333 | 333 |
334 } // namespace | 334 } // namespace |
335 } // namespace cc | 335 } // namespace cc |
OLD | NEW |