Index: cc/test/output_test_common.h |
diff --git a/cc/test/output_test_common.h b/cc/test/output_test_common.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f07355e05f5e90e67c87ef4d0629891e35ec4cae |
--- /dev/null |
+++ b/cc/test/output_test_common.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CC_TEST_OUTPUT_TEST_COMMON_H_ |
+#define CC_TEST_OUTPUT_TEST_COMMON_H_ |
+ |
+#include <iosfwd> |
+ |
+#include "base/basictypes.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/time/time.h" |
+#include "cc/output/begin_frame_args.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace cc { |
+ |
+BeginFrameArgs BeginFrameArgsCreate(int64 frame_time, |
+ int64 deadline, |
+ int64 interval) { |
+ return BeginFrameArgs::Create(base::TimeTicks::FromInternalValue(frame_time), |
+ base::TimeTicks::FromInternalValue(deadline), |
+ base::TimeDelta::FromInternalValue(deadline)); |
+} |
+ |
+// gtest helpers -- these *must* be in the same namespace as the types they |
+// operate on. |
+ |
+// Allow "EXPECT_EQ(args1, args2);" |
+// We don't define operator!= because EXPECT_NE(args1, args2) isn't all that |
+// sensible. |
+bool operator==(BeginFrameArgs lhs, BeginFrameArgs rhs) { |
+ return (lhs.frame_time == rhs.frame_time) && (lhs.deadline == rhs.deadline) && |
+ (lhs.interval == rhs.interval); |
+} |
+ |
+// Allow gtest to pretty print begin frame args. |
+void PrintTo(const BeginFrameArgs& args, ::std::ostream* os) { |
+ *os << "BeginFrameArgs(" << args.frame_time.ToInternalValue() << ", " |
+ << args.deadline.ToInternalValue() << ", " |
+ << args.interval.InMicroseconds() << "us)"; |
+} |
+ |
+} // namespace cc |
+ |
+#endif // CC_TEST_OUTPUT_TEST_COMMON_H_ |