Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1756)

Unified Diff: cc/test/output_test_common.h

Issue 267783004: Refactoring the way begin frame sources inside scheduler work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Scheduler now uses frame sources, working on scheduler_unittests. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698