OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "cc/surfaces/display_scheduler.h" | 5 #include "cc/surfaces/display_scheduler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/test/null_task_runner.h" | 8 #include "base/test/null_task_runner.h" |
9 #include "base/test/simple_test_tick_clock.h" | 9 #include "base/test/simple_test_tick_clock.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 protected: | 39 protected: |
40 int draw_and_swap_count_; | 40 int draw_and_swap_count_; |
41 }; | 41 }; |
42 | 42 |
43 class TestDisplayScheduler : public DisplayScheduler { | 43 class TestDisplayScheduler : public DisplayScheduler { |
44 public: | 44 public: |
45 TestDisplayScheduler(BeginFrameSource* begin_frame_source, | 45 TestDisplayScheduler(BeginFrameSource* begin_frame_source, |
46 base::SingleThreadTaskRunner* task_runner, | 46 base::SingleThreadTaskRunner* task_runner, |
47 int max_pending_swaps) | 47 int max_pending_swaps) |
48 : DisplayScheduler(begin_frame_source, task_runner, max_pending_swaps), | 48 : DisplayScheduler(task_runner, max_pending_swaps), |
49 scheduler_begin_frame_deadline_count_(0) {} | 49 scheduler_begin_frame_deadline_count_(0) { |
| 50 SetBeginFrameSource(begin_frame_source); |
| 51 } |
50 | 52 |
51 base::TimeTicks DesiredBeginFrameDeadlineTimeForTest() { | 53 base::TimeTicks DesiredBeginFrameDeadlineTimeForTest() { |
52 return DesiredBeginFrameDeadlineTime(); | 54 return DesiredBeginFrameDeadlineTime(); |
53 } | 55 } |
54 | 56 |
55 void BeginFrameDeadlineForTest() { OnBeginFrameDeadline(); } | 57 void BeginFrameDeadlineForTest() { OnBeginFrameDeadline(); } |
56 | 58 |
57 void ScheduleBeginFrameDeadline() override { | 59 void ScheduleBeginFrameDeadline() override { |
58 scheduler_begin_frame_deadline_count_++; | 60 scheduler_begin_frame_deadline_count_++; |
59 DisplayScheduler::ScheduleBeginFrameDeadline(); | 61 DisplayScheduler::ScheduleBeginFrameDeadline(); |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 | 570 |
569 scheduler_.SetRootSurfaceResourcesLocked(true); | 571 scheduler_.SetRootSurfaceResourcesLocked(true); |
570 EXPECT_EQ(++count, scheduler_.scheduler_begin_frame_deadline_count()); | 572 EXPECT_EQ(++count, scheduler_.scheduler_begin_frame_deadline_count()); |
571 | 573 |
572 scheduler_.OutputSurfaceLost(); | 574 scheduler_.OutputSurfaceLost(); |
573 EXPECT_EQ(++count, scheduler_.scheduler_begin_frame_deadline_count()); | 575 EXPECT_EQ(++count, scheduler_.scheduler_begin_frame_deadline_count()); |
574 } | 576 } |
575 | 577 |
576 } // namespace | 578 } // namespace |
577 } // namespace cc | 579 } // namespace cc |
OLD | NEW |