| 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 "cc/test/begin_frame_args_test.h" | 5 #include "cc/test/begin_frame_args_test.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "cc/output/begin_frame_args.h" | 8 #include "cc/output/begin_frame_args.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| 11 | 11 |
| 12 BeginFrameArgs CreateBeginFrameArgsForTesting( | 12 BeginFrameArgs CreateBeginFrameArgsForTesting( |
| 13 BeginFrameArgs::CreationLocation location) { | 13 BeginFrameArgs::CreationLocation location) { |
| 14 return CreateBeginFrameArgsForTesting(location, base::TimeTicks::Now()); | 14 return CreateBeginFrameArgsForTesting(location, base::TimeTicks::Now()); |
| 15 } | 15 } |
| 16 | 16 |
| 17 BeginFrameArgs CreateBeginFrameArgsForTesting( | 17 BeginFrameArgs CreateBeginFrameArgsForTesting( |
| 18 BeginFrameArgs::CreationLocation location, | 18 BeginFrameArgs::CreationLocation location, |
| 19 base::TimeTicks frame_time) { | 19 base::TimeTicks frame_time) { |
| 20 return BeginFrameArgs::Create( | 20 return BeginFrameArgs::Create( |
| 21 location, frame_time, | 21 location, frame_time, |
| 22 frame_time + (BeginFrameArgs::DefaultInterval() / 2), | 22 frame_time + BeginFrameArgs::DefaultInterval() - |
| 23 BeginFrameArgs::DefaultEstimatedParentDrawTime(), |
| 23 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); | 24 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); |
| 24 } | 25 } |
| 25 | 26 |
| 26 BeginFrameArgs CreateBeginFrameArgsForTesting( | 27 BeginFrameArgs CreateBeginFrameArgsForTesting( |
| 27 BeginFrameArgs::CreationLocation location, | 28 BeginFrameArgs::CreationLocation location, |
| 28 int64 frame_time, | 29 int64 frame_time, |
| 29 int64 deadline, | 30 int64 deadline, |
| 30 int64 interval) { | 31 int64 interval) { |
| 31 return BeginFrameArgs::Create( | 32 return BeginFrameArgs::Create( |
| 32 location, base::TimeTicks::FromInternalValue(frame_time), | 33 location, base::TimeTicks::FromInternalValue(frame_time), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 52 return BeginFrameArgs::Create( | 53 return BeginFrameArgs::Create( |
| 53 location, now, now - BeginFrameArgs::DefaultInterval(), | 54 location, now, now - BeginFrameArgs::DefaultInterval(), |
| 54 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); | 55 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); |
| 55 } | 56 } |
| 56 | 57 |
| 57 BeginFrameArgs CreateBeginFrameArgsForTesting( | 58 BeginFrameArgs CreateBeginFrameArgsForTesting( |
| 58 BeginFrameArgs::CreationLocation location, | 59 BeginFrameArgs::CreationLocation location, |
| 59 scoped_refptr<TestNowSource> now_src) { | 60 scoped_refptr<TestNowSource> now_src) { |
| 60 base::TimeTicks now = now_src->Now(); | 61 base::TimeTicks now = now_src->Now(); |
| 61 return BeginFrameArgs::Create( | 62 return BeginFrameArgs::Create( |
| 62 location, now, now + (BeginFrameArgs::DefaultInterval() / 2), | 63 location, now, now + BeginFrameArgs::DefaultInterval() - |
| 64 BeginFrameArgs::DefaultEstimatedParentDrawTime(), |
| 63 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); | 65 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); |
| 64 } | 66 } |
| 65 | 67 |
| 66 BeginFrameArgs CreateExpiredBeginFrameArgsForTesting( | 68 BeginFrameArgs CreateExpiredBeginFrameArgsForTesting( |
| 67 BeginFrameArgs::CreationLocation location, | 69 BeginFrameArgs::CreationLocation location, |
| 68 scoped_refptr<TestNowSource> now_src) { | 70 scoped_refptr<TestNowSource> now_src) { |
| 69 base::TimeTicks now = now_src->Now(); | 71 base::TimeTicks now = now_src->Now(); |
| 70 return BeginFrameArgs::Create( | 72 return BeginFrameArgs::Create( |
| 71 location, now, now - BeginFrameArgs::DefaultInterval(), | 73 location, now, now - BeginFrameArgs::DefaultInterval(), |
| 72 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); | 74 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 83 } | 85 } |
| 84 | 86 |
| 85 void PrintTo(const BeginFrameArgs& args, ::std::ostream* os) { | 87 void PrintTo(const BeginFrameArgs& args, ::std::ostream* os) { |
| 86 *os << "BeginFrameArgs(" << BeginFrameArgs::TypeToString(args.type) << ", " | 88 *os << "BeginFrameArgs(" << BeginFrameArgs::TypeToString(args.type) << ", " |
| 87 << args.frame_time.ToInternalValue() << ", " | 89 << args.frame_time.ToInternalValue() << ", " |
| 88 << args.deadline.ToInternalValue() << ", " | 90 << args.deadline.ToInternalValue() << ", " |
| 89 << args.interval.InMicroseconds() << "us)"; | 91 << args.interval.InMicroseconds() << "us)"; |
| 90 } | 92 } |
| 91 | 93 |
| 92 } // namespace cc | 94 } // namespace cc |
| OLD | NEW |