OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_TEST_OUTPUT_TEST_COMMON_H_ |
| 6 #define CC_TEST_OUTPUT_TEST_COMMON_H_ |
| 7 |
| 8 #include <iosfwd> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/time/time.h" |
| 13 #include "cc/output/begin_frame_args.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 |
| 16 namespace cc { |
| 17 |
| 18 BeginFrameArgs BeginFrameArgsCreate(int64 frame_time, |
| 19 int64 deadline, |
| 20 int64 interval) { |
| 21 return BeginFrameArgs::Create(base::TimeTicks::FromInternalValue(frame_time), |
| 22 base::TimeTicks::FromInternalValue(deadline), |
| 23 base::TimeDelta::FromInternalValue(deadline)); |
| 24 } |
| 25 |
| 26 // gtest helpers -- these *must* be in the same namespace as the types they |
| 27 // operate on. |
| 28 |
| 29 // Allow "EXPECT_EQ(args1, args2);" |
| 30 // We don't define operator!= because EXPECT_NE(args1, args2) isn't all that |
| 31 // sensible. |
| 32 bool operator==(BeginFrameArgs lhs, BeginFrameArgs rhs) { |
| 33 return (lhs.frame_time == rhs.frame_time) && (lhs.deadline == rhs.deadline) && |
| 34 (lhs.interval == rhs.interval); |
| 35 } |
| 36 |
| 37 // Allow gtest to pretty print begin frame args. |
| 38 void PrintTo(const BeginFrameArgs& args, ::std::ostream* os) { |
| 39 *os << "BeginFrameArgs(" << args.frame_time.ToInternalValue() << ", " |
| 40 << args.deadline.ToInternalValue() << ", " |
| 41 << args.interval.InMicroseconds() << "us)"; |
| 42 } |
| 43 |
| 44 } // namespace cc |
| 45 |
| 46 #endif // CC_TEST_OUTPUT_TEST_COMMON_H_ |
OLD | NEW |