OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/scheduler/scheduler.h" | 5 #include "cc/scheduler/scheduler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 return CallOnBeginFrame(args); | 232 return CallOnBeginFrame(args); |
233 } | 233 } |
234 | 234 |
235 private: | 235 private: |
236 FakeSchedulerClient* client_; | 236 FakeSchedulerClient* client_; |
237 }; | 237 }; |
238 | 238 |
239 class SchedulerTest : public testing::Test { | 239 class SchedulerTest : public testing::Test { |
240 public: | 240 public: |
241 SchedulerTest() | 241 SchedulerTest() |
242 : now_src_(new base::SimpleTestTickClock()), | 242 : now_src_(new base::SimpleTestTickClock( |
| 243 base::TimeTicks() + base::TimeDelta::FromMicroseconds(1))), |
243 task_runner_(new OrderedSimpleTaskRunner(now_src_.get(), true)), | 244 task_runner_(new OrderedSimpleTaskRunner(now_src_.get(), true)), |
244 fake_external_begin_frame_source_(nullptr) { | 245 fake_external_begin_frame_source_(nullptr) { |
245 now_src_->Advance(base::TimeDelta::FromMicroseconds(10000)); | |
246 // A bunch of tests require NowTicks() | 246 // A bunch of tests require NowTicks() |
247 // to be > BeginFrameArgs::DefaultInterval() | 247 // to be > BeginFrameArgs::DefaultInterval() |
248 now_src_->Advance(base::TimeDelta::FromMilliseconds(100)); | 248 now_src_->Advance(base::TimeDelta::FromMilliseconds(100)); |
249 // Fail if we need to run 100 tasks in a row. | 249 // Fail if we need to run 100 tasks in a row. |
250 task_runner_->SetRunTaskLimit(100); | 250 task_runner_->SetRunTaskLimit(100); |
251 } | 251 } |
252 | 252 |
253 ~SchedulerTest() override {} | 253 ~SchedulerTest() override {} |
254 | 254 |
255 protected: | 255 protected: |
(...skipping 3298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3554 } | 3554 } |
3555 | 3555 |
3556 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHS) { | 3556 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHS) { |
3557 EXPECT_FALSE(BeginMainFrameOnCriticalPath( | 3557 EXPECT_FALSE(BeginMainFrameOnCriticalPath( |
3558 SMOOTHNESS_TAKES_PRIORITY, | 3558 SMOOTHNESS_TAKES_PRIORITY, |
3559 ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration)); | 3559 ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration)); |
3560 } | 3560 } |
3561 | 3561 |
3562 } // namespace | 3562 } // namespace |
3563 } // namespace cc | 3563 } // namespace cc |
OLD | NEW |