OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/scheduler/renderer/auto_advancing_virtual_time_domain.h" | 5 #include "platform/scheduler/renderer/auto_advancing_virtual_time_domain.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/test/simple_test_tick_clock.h" | 8 #include "base/test/simple_test_tick_clock.h" |
9 #include "cc/test/ordered_simple_task_runner.h" | 9 #include "cc/test/ordered_simple_task_runner.h" |
10 #include "platform/scheduler/base/task_queue_manager.h" | 10 #include "platform/scheduler/base/task_queue_manager.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 std::unique_ptr<TaskQueueManager> manager_; | 56 std::unique_ptr<TaskQueueManager> manager_; |
57 scoped_refptr<TaskQueue> task_queue_; | 57 scoped_refptr<TaskQueue> task_queue_; |
58 std::unique_ptr<AutoAdvancingVirtualTimeDomain> auto_advancing_time_domain_; | 58 std::unique_ptr<AutoAdvancingVirtualTimeDomain> auto_advancing_time_domain_; |
59 TestTaskTimeObserver test_task_time_observer_; | 59 TestTaskTimeObserver test_task_time_observer_; |
60 }; | 60 }; |
61 | 61 |
62 namespace { | 62 namespace { |
63 void NopTask(bool* task_run) { | 63 void NopTask(bool* task_run) { |
64 *task_run = true; | 64 *task_run = true; |
65 } | 65 } |
66 } // namesapce | 66 } // namespace |
67 | 67 |
68 TEST_F(AutoAdvancingVirtualTimeDomainTest, VirtualTimeAdvances) { | 68 TEST_F(AutoAdvancingVirtualTimeDomainTest, VirtualTimeAdvances) { |
69 base::TimeDelta delay = base::TimeDelta::FromMilliseconds(10); | 69 base::TimeDelta delay = base::TimeDelta::FromMilliseconds(10); |
70 bool task_run = false; | 70 bool task_run = false; |
71 task_queue_->PostDelayedTask(FROM_HERE, base::Bind(NopTask, &task_run), | 71 task_queue_->PostDelayedTask(FROM_HERE, base::Bind(NopTask, &task_run), |
72 delay); | 72 delay); |
73 | 73 |
74 mock_task_runner_->RunUntilIdle(); | 74 mock_task_runner_->RunUntilIdle(); |
75 | 75 |
76 EXPECT_EQ(initial_time_, clock_->NowTicks()); | 76 EXPECT_EQ(initial_time_, clock_->NowTicks()); |
(...skipping 12 matching lines...) Expand all Loading... |
89 | 89 |
90 mock_task_runner_->RunUntilIdle(); | 90 mock_task_runner_->RunUntilIdle(); |
91 | 91 |
92 EXPECT_EQ(initial_time_, clock_->NowTicks()); | 92 EXPECT_EQ(initial_time_, clock_->NowTicks()); |
93 EXPECT_EQ(initial_time_, auto_advancing_time_domain_->CreateLazyNow().Now()); | 93 EXPECT_EQ(initial_time_, auto_advancing_time_domain_->CreateLazyNow().Now()); |
94 EXPECT_FALSE(task_run); | 94 EXPECT_FALSE(task_run); |
95 } | 95 } |
96 | 96 |
97 } // namespace scheduler | 97 } // namespace scheduler |
98 } // namespace blink | 98 } // namespace blink |
OLD | NEW |