| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 return scheduler_begin_frame_deadline_count_; | 64 return scheduler_begin_frame_deadline_count_; |
| 65 } | 65 } |
| 66 | 66 |
| 67 protected: | 67 protected: |
| 68 int scheduler_begin_frame_deadline_count_; | 68 int scheduler_begin_frame_deadline_count_; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 class DisplaySchedulerTest : public testing::Test { | 71 class DisplaySchedulerTest : public testing::Test { |
| 72 public: | 72 public: |
| 73 DisplaySchedulerTest() | 73 DisplaySchedulerTest() |
| 74 : now_src_(new base::SimpleTestTickClock()), | 74 : now_src_(new base::SimpleTestTickClock( |
| 75 base::TimeTicks() + base::TimeDelta::FromMicroseconds(1))), |
| 75 task_runner_(new base::NullTaskRunner), | 76 task_runner_(new base::NullTaskRunner), |
| 76 client_(new FakeDisplaySchedulerClient), | 77 client_(new FakeDisplaySchedulerClient), |
| 77 scheduler_(new TestDisplayScheduler(client_.get(), | 78 scheduler_(new TestDisplayScheduler(client_.get(), |
| 78 &fake_begin_frame_source_, | 79 &fake_begin_frame_source_, |
| 79 task_runner_.get(), | 80 task_runner_.get(), |
| 80 kMaxPendingSwaps)) { | 81 kMaxPendingSwaps)) {} |
| 81 now_src_->Advance(base::TimeDelta::FromMicroseconds(10000)); | |
| 82 } | |
| 83 | 82 |
| 84 ~DisplaySchedulerTest() override {} | 83 ~DisplaySchedulerTest() override {} |
| 85 | 84 |
| 86 void SetUp() override { scheduler_->SetRootSurfaceResourcesLocked(false); } | 85 void SetUp() override { scheduler_->SetRootSurfaceResourcesLocked(false); } |
| 87 | 86 |
| 88 void BeginFrameForTest() { | 87 void BeginFrameForTest() { |
| 89 base::TimeTicks frame_time = now_src_->NowTicks(); | 88 base::TimeTicks frame_time = now_src_->NowTicks(); |
| 90 base::TimeDelta interval = BeginFrameArgs::DefaultInterval(); | 89 base::TimeDelta interval = BeginFrameArgs::DefaultInterval(); |
| 91 base::TimeTicks deadline = frame_time + interval; | 90 base::TimeTicks deadline = frame_time + interval; |
| 92 fake_begin_frame_source_.TestOnBeginFrame( | 91 fake_begin_frame_source_.TestOnBeginFrame( |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 415 |
| 417 scheduler_->SetRootSurfaceResourcesLocked(true); | 416 scheduler_->SetRootSurfaceResourcesLocked(true); |
| 418 EXPECT_EQ(count++, scheduler_->scheduler_begin_frame_deadline_count()); | 417 EXPECT_EQ(count++, scheduler_->scheduler_begin_frame_deadline_count()); |
| 419 | 418 |
| 420 scheduler_->OutputSurfaceLost(); | 419 scheduler_->OutputSurfaceLost(); |
| 421 EXPECT_EQ(count++, scheduler_->scheduler_begin_frame_deadline_count()); | 420 EXPECT_EQ(count++, scheduler_->scheduler_begin_frame_deadline_count()); |
| 422 } | 421 } |
| 423 | 422 |
| 424 } // namespace | 423 } // namespace |
| 425 } // namespace cc | 424 } // namespace cc |
| OLD | NEW |