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 { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 BeginFrameArgs CreateExpiredBeginFrameArgsForTesting( | 49 BeginFrameArgs CreateExpiredBeginFrameArgsForTesting( |
50 BeginFrameArgs::CreationLocation location) { | 50 BeginFrameArgs::CreationLocation location) { |
51 base::TimeTicks now = base::TimeTicks::Now(); | 51 base::TimeTicks now = base::TimeTicks::Now(); |
52 return BeginFrameArgs::Create( | 52 return BeginFrameArgs::Create( |
53 location, now, now - BeginFrameArgs::DefaultInterval(), | 53 location, now, now - BeginFrameArgs::DefaultInterval(), |
54 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); | 54 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); |
55 } | 55 } |
56 | 56 |
57 BeginFrameArgs CreateBeginFrameArgsForTesting( | 57 BeginFrameArgs CreateBeginFrameArgsForTesting( |
58 BeginFrameArgs::CreationLocation location, | 58 BeginFrameArgs::CreationLocation location, |
59 scoped_refptr<TestNowSource> now_src) { | 59 base::SimpleTestTickClock* now_src) { |
60 base::TimeTicks now = now_src->Now(); | 60 base::TimeTicks now = now_src->NowTicks(); |
61 return BeginFrameArgs::Create( | 61 return BeginFrameArgs::Create( |
62 location, now, now + (BeginFrameArgs::DefaultInterval() / 2), | 62 location, now, now + (BeginFrameArgs::DefaultInterval() / 2), |
63 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); | 63 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); |
64 } | 64 } |
65 | 65 |
66 BeginFrameArgs CreateExpiredBeginFrameArgsForTesting( | 66 BeginFrameArgs CreateExpiredBeginFrameArgsForTesting( |
67 BeginFrameArgs::CreationLocation location, | 67 BeginFrameArgs::CreationLocation location, |
68 scoped_refptr<TestNowSource> now_src) { | 68 base::SimpleTestTickClock* now_src) { |
69 base::TimeTicks now = now_src->Now(); | 69 base::TimeTicks now = now_src->NowTicks(); |
70 return BeginFrameArgs::Create( | 70 return BeginFrameArgs::Create( |
71 location, now, now - BeginFrameArgs::DefaultInterval(), | 71 location, now, now - BeginFrameArgs::DefaultInterval(), |
72 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); | 72 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); |
73 } | 73 } |
74 | 74 |
75 bool operator==(const BeginFrameArgs& lhs, const BeginFrameArgs& rhs) { | 75 bool operator==(const BeginFrameArgs& lhs, const BeginFrameArgs& rhs) { |
76 return (lhs.type == rhs.type) && (lhs.frame_time == rhs.frame_time) && | 76 return (lhs.type == rhs.type) && (lhs.frame_time == rhs.frame_time) && |
77 (lhs.deadline == rhs.deadline) && (lhs.interval == rhs.interval); | 77 (lhs.deadline == rhs.deadline) && (lhs.interval == rhs.interval); |
78 } | 78 } |
79 | 79 |
80 ::std::ostream& operator<<(::std::ostream& os, const BeginFrameArgs& args) { | 80 ::std::ostream& operator<<(::std::ostream& os, const BeginFrameArgs& args) { |
81 PrintTo(args, &os); | 81 PrintTo(args, &os); |
82 return os; | 82 return os; |
83 } | 83 } |
84 | 84 |
85 void PrintTo(const BeginFrameArgs& args, ::std::ostream* os) { | 85 void PrintTo(const BeginFrameArgs& args, ::std::ostream* os) { |
86 *os << "BeginFrameArgs(" << BeginFrameArgs::TypeToString(args.type) << ", " | 86 *os << "BeginFrameArgs(" << BeginFrameArgs::TypeToString(args.type) << ", " |
87 << args.frame_time.ToInternalValue() << ", " | 87 << args.frame_time.ToInternalValue() << ", " |
88 << args.deadline.ToInternalValue() << ", " | 88 << args.deadline.ToInternalValue() << ", " |
89 << args.interval.InMicroseconds() << "us)"; | 89 << args.interval.InMicroseconds() << "us)"; |
90 } | 90 } |
91 | 91 |
92 } // namespace cc | 92 } // namespace cc |
OLD | NEW |