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

Unified Diff: cc/output/begin_frame_args_unittest.cc

Issue 2527283003: cc: Introduce BeginFrame sequence numbers and acknowledgements.
Patch Set: Address Brian's comments. Created 4 years 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
« no previous file with comments | « cc/output/begin_frame_args.cc ('k') | cc/output/compositor_frame_metadata.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/begin_frame_args_unittest.cc
diff --git a/cc/output/begin_frame_args_unittest.cc b/cc/output/begin_frame_args_unittest.cc
index eb63cc769a115f15d513bbf1473aab7857d6bbb8..65e0e9f66a48b79d89bc9a2811efe97ce019b193 100644
--- a/cc/output/begin_frame_args_unittest.cc
+++ b/cc/output/begin_frame_args_unittest.cc
@@ -14,56 +14,79 @@ namespace {
TEST(BeginFrameArgsTest, Helpers) {
// Quick create methods work
- BeginFrameArgs args0 = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE);
+ BeginFrameArgs args0 =
+ CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1);
EXPECT_TRUE(args0.IsValid()) << args0;
BeginFrameArgs args1 =
- CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 0, -1);
+ CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1, 0, 0, -1);
EXPECT_FALSE(args1.IsValid()) << args1;
BeginFrameArgs args2 =
- CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 1, 2, 3);
+ CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 123, 10, 1, 2, 3);
EXPECT_TRUE(args2.IsValid()) << args2;
+ EXPECT_EQ(123u, args2.source_id);
+ EXPECT_EQ(10u, args2.sequence_number);
EXPECT_EQ(1, args2.frame_time.ToInternalValue());
EXPECT_EQ(2, args2.deadline.ToInternalValue());
EXPECT_EQ(3, args2.interval.ToInternalValue());
EXPECT_EQ(BeginFrameArgs::NORMAL, args2.type);
BeginFrameArgs args4 = CreateBeginFrameArgsForTesting(
- BEGINFRAME_FROM_HERE, 1, 2, 3, BeginFrameArgs::MISSED);
+ BEGINFRAME_FROM_HERE, 234, 20, 1, 2, 3, BeginFrameArgs::MISSED);
EXPECT_TRUE(args4.IsValid()) << args4;
+ EXPECT_EQ(234u, args4.source_id);
+ EXPECT_EQ(20u, args4.sequence_number);
EXPECT_EQ(1, args4.frame_time.ToInternalValue());
EXPECT_EQ(2, args4.deadline.ToInternalValue());
EXPECT_EQ(3, args4.interval.ToInternalValue());
EXPECT_EQ(BeginFrameArgs::MISSED, args4.type);
// operator==
- EXPECT_EQ(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 4, 5, 6),
- CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 4, 5, 6));
+ EXPECT_EQ(
+ CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 123, 20, 4, 5, 6),
+ CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 123, 20, 4, 5, 6));
EXPECT_NONFATAL_FAILURE(
- EXPECT_EQ(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 7, 8, 9,
- BeginFrameArgs::MISSED),
- CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 7, 8, 9)),
+ EXPECT_EQ(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 123, 30, 7,
+ 8, 9, BeginFrameArgs::MISSED),
+ CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 123, 30, 7,
+ 8, 9)),
"");
EXPECT_NONFATAL_FAILURE(
- EXPECT_EQ(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 4, 5, 6),
- CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 7, 8, 9)),
+ EXPECT_EQ(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 123, 30, 4,
+ 5, 6),
+ CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 123, 30, 7,
+ 8, 9)),
+ "");
+
+ EXPECT_NONFATAL_FAILURE(
+ EXPECT_EQ(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 123, 30, 7,
+ 8, 9),
+ CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 123, 40, 7,
+ 8, 9)),
+ "");
+
+ EXPECT_NONFATAL_FAILURE(
+ EXPECT_EQ(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 123, 30, 7,
+ 8, 9),
+ CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 234, 30, 7,
+ 8, 9)),
"");
// operator<<
std::stringstream out1;
out1 << args1;
- EXPECT_EQ("BeginFrameArgs(NORMAL, 0, 0, -1us)", out1.str());
+ EXPECT_EQ("BeginFrameArgs(NORMAL, 0, 1, 0, 0, -1us)", out1.str());
std::stringstream out2;
out2 << args2;
- EXPECT_EQ("BeginFrameArgs(NORMAL, 1, 2, 3us)", out2.str());
+ EXPECT_EQ("BeginFrameArgs(NORMAL, 123, 10, 1, 2, 3us)", out2.str());
// PrintTo
- EXPECT_EQ(std::string("BeginFrameArgs(NORMAL, 0, 0, -1us)"),
+ EXPECT_EQ(std::string("BeginFrameArgs(NORMAL, 0, 1, 0, 0, -1us)"),
::testing::PrintToString(args1));
- EXPECT_EQ(std::string("BeginFrameArgs(NORMAL, 1, 2, 3us)"),
+ EXPECT_EQ(std::string("BeginFrameArgs(NORMAL, 123, 10, 1, 2, 3us)"),
::testing::PrintToString(args2));
}
@@ -74,10 +97,12 @@ TEST(BeginFrameArgsTest, Create) {
EXPECT_TRUE(args1.on_critical_path);
BeginFrameArgs args2 = BeginFrameArgs::Create(
- BEGINFRAME_FROM_HERE, base::TimeTicks::FromInternalValue(1),
+ BEGINFRAME_FROM_HERE, 123, 10, base::TimeTicks::FromInternalValue(1),
base::TimeTicks::FromInternalValue(2),
base::TimeDelta::FromInternalValue(3), BeginFrameArgs::NORMAL);
EXPECT_TRUE(args2.IsValid()) << args2;
+ EXPECT_EQ(123u, args2.source_id) << args2;
+ EXPECT_EQ(10u, args2.sequence_number) << args2;
EXPECT_EQ(1, args2.frame_time.ToInternalValue()) << args2;
EXPECT_EQ(2, args2.deadline.ToInternalValue()) << args2;
EXPECT_EQ(3, args2.interval.ToInternalValue()) << args2;
@@ -88,7 +113,7 @@ TEST(BeginFrameArgsTest, Create) {
TEST(BeginFrameArgsTest, Location) {
tracked_objects::Location expected_location = BEGINFRAME_FROM_HERE;
- BeginFrameArgs args = CreateBeginFrameArgsForTesting(expected_location);
+ BeginFrameArgs args = CreateBeginFrameArgsForTesting(expected_location, 0, 1);
EXPECT_EQ(expected_location.ToString(), args.created_from.ToString());
}
#endif
« no previous file with comments | « cc/output/begin_frame_args.cc ('k') | cc/output/compositor_frame_metadata.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698