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