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" | |
10 | 9 |
11 namespace cc { | 10 namespace cc { |
12 | 11 |
13 BeginFrameArgs CreateBeginFrameArgsForTesting( | 12 BeginFrameArgs CreateBeginFrameArgsForTesting( |
14 BeginFrameArgs::CreationLocation location) { | 13 BeginFrameArgs::CreationLocation location) { |
15 return CreateBeginFrameArgsForTesting(location, gfx::FrameTime::Now()); | 14 return CreateBeginFrameArgsForTesting(location, base::TimeTicks::Now()); |
16 } | 15 } |
17 | 16 |
18 BeginFrameArgs CreateBeginFrameArgsForTesting( | 17 BeginFrameArgs CreateBeginFrameArgsForTesting( |
19 BeginFrameArgs::CreationLocation location, | 18 BeginFrameArgs::CreationLocation location, |
20 base::TimeTicks frame_time) { | 19 base::TimeTicks frame_time) { |
21 return BeginFrameArgs::Create( | 20 return BeginFrameArgs::Create( |
22 location, frame_time, | 21 location, frame_time, |
23 frame_time + (BeginFrameArgs::DefaultInterval() / 2), | 22 frame_time + (BeginFrameArgs::DefaultInterval() / 2), |
24 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); | 23 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); |
25 } | 24 } |
(...skipping 16 matching lines...) Expand all Loading... |
42 int64 interval, | 41 int64 interval, |
43 BeginFrameArgs::BeginFrameArgsType type) { | 42 BeginFrameArgs::BeginFrameArgsType type) { |
44 return BeginFrameArgs::Create( | 43 return BeginFrameArgs::Create( |
45 location, base::TimeTicks::FromInternalValue(frame_time), | 44 location, base::TimeTicks::FromInternalValue(frame_time), |
46 base::TimeTicks::FromInternalValue(deadline), | 45 base::TimeTicks::FromInternalValue(deadline), |
47 base::TimeDelta::FromInternalValue(interval), type); | 46 base::TimeDelta::FromInternalValue(interval), type); |
48 } | 47 } |
49 | 48 |
50 BeginFrameArgs CreateExpiredBeginFrameArgsForTesting( | 49 BeginFrameArgs CreateExpiredBeginFrameArgsForTesting( |
51 BeginFrameArgs::CreationLocation location) { | 50 BeginFrameArgs::CreationLocation location) { |
52 base::TimeTicks now = gfx::FrameTime::Now(); | 51 base::TimeTicks now = base::TimeTicks::Now(); |
53 return BeginFrameArgs::Create( | 52 return BeginFrameArgs::Create( |
54 location, now, now - BeginFrameArgs::DefaultInterval(), | 53 location, now, now - BeginFrameArgs::DefaultInterval(), |
55 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); | 54 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); |
56 } | 55 } |
57 | 56 |
58 BeginFrameArgs CreateBeginFrameArgsForTesting( | 57 BeginFrameArgs CreateBeginFrameArgsForTesting( |
59 BeginFrameArgs::CreationLocation location, | 58 BeginFrameArgs::CreationLocation location, |
60 scoped_refptr<TestNowSource> now_src) { | 59 scoped_refptr<TestNowSource> now_src) { |
61 base::TimeTicks now = now_src->Now(); | 60 base::TimeTicks now = now_src->Now(); |
62 return BeginFrameArgs::Create( | 61 return BeginFrameArgs::Create( |
(...skipping 21 matching lines...) Expand all Loading... |
84 } | 83 } |
85 | 84 |
86 void PrintTo(const BeginFrameArgs& args, ::std::ostream* os) { | 85 void PrintTo(const BeginFrameArgs& args, ::std::ostream* os) { |
87 *os << "BeginFrameArgs(" << BeginFrameArgs::TypeToString(args.type) << ", " | 86 *os << "BeginFrameArgs(" << BeginFrameArgs::TypeToString(args.type) << ", " |
88 << args.frame_time.ToInternalValue() << ", " | 87 << args.frame_time.ToInternalValue() << ", " |
89 << args.deadline.ToInternalValue() << ", " | 88 << args.deadline.ToInternalValue() << ", " |
90 << args.interval.InMicroseconds() << "us)"; | 89 << args.interval.InMicroseconds() << "us)"; |
91 } | 90 } |
92 | 91 |
93 } // namespace cc | 92 } // namespace cc |
OLD | NEW |