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

Side by Side Diff: cc/output/begin_frame_args_unittest.cc

Issue 2493853002: cc/blimp: Proto Cleanup. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « cc/output/begin_frame_args.cc ('k') | cc/output/managed_memory_policy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 5 #include <string>
6 6
7 #include "cc/output/begin_frame_args.h" 7 #include "cc/output/begin_frame_args.h"
8 #include "cc/proto/begin_main_frame_and_commit_state.pb.h"
9 #include "cc/test/begin_frame_args_test.h" 8 #include "cc/test/begin_frame_args_test.h"
10 #include "testing/gtest/include/gtest/gtest-spi.h" 9 #include "testing/gtest/include/gtest/gtest-spi.h"
11 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
12 11
13 namespace cc { 12 namespace cc {
14 namespace { 13 namespace {
15 14
16 TEST(BeginFrameArgsTest, Helpers) { 15 TEST(BeginFrameArgsTest, Helpers) {
17 // Quick create methods work 16 // Quick create methods work
18 BeginFrameArgs args0 = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); 17 BeginFrameArgs args0 = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 BEGINFRAME_FROM_HERE, base::TimeTicks::FromInternalValue(1), 77 BEGINFRAME_FROM_HERE, base::TimeTicks::FromInternalValue(1),
79 base::TimeTicks::FromInternalValue(2), 78 base::TimeTicks::FromInternalValue(2),
80 base::TimeDelta::FromInternalValue(3), BeginFrameArgs::NORMAL); 79 base::TimeDelta::FromInternalValue(3), BeginFrameArgs::NORMAL);
81 EXPECT_TRUE(args2.IsValid()) << args2; 80 EXPECT_TRUE(args2.IsValid()) << args2;
82 EXPECT_EQ(1, args2.frame_time.ToInternalValue()) << args2; 81 EXPECT_EQ(1, args2.frame_time.ToInternalValue()) << args2;
83 EXPECT_EQ(2, args2.deadline.ToInternalValue()) << args2; 82 EXPECT_EQ(2, args2.deadline.ToInternalValue()) << args2;
84 EXPECT_EQ(3, args2.interval.ToInternalValue()) << args2; 83 EXPECT_EQ(3, args2.interval.ToInternalValue()) << args2;
85 EXPECT_EQ(BeginFrameArgs::NORMAL, args2.type) << args2; 84 EXPECT_EQ(BeginFrameArgs::NORMAL, args2.type) << args2;
86 } 85 }
87 86
88 TEST(BeginFrameArgsSerializationTest, BeginFrameArgsType) {
89 for (size_t i = 0;
90 i < BeginFrameArgs::BeginFrameArgsType::BEGIN_FRAME_ARGS_TYPE_MAX; ++i) {
91 BeginFrameArgs::BeginFrameArgsType type =
92 static_cast<BeginFrameArgs::BeginFrameArgsType>(i);
93 BeginFrameArgs args;
94 args.type = type;
95
96 proto::BeginFrameArgs proto;
97 args.BeginFrameArgsTypeToProtobuf(&proto);
98
99 BeginFrameArgs new_args;
100 new_args.BeginFrameArgsTypeFromProtobuf(proto);
101 EXPECT_EQ(args.type, new_args.type);
102 }
103 }
104
105 TEST(BeginFrameArgsSerializationTest, BeginFrameArgs) {
106 BeginFrameArgs args = BeginFrameArgs::Create(
107 BEGINFRAME_FROM_HERE, base::TimeTicks::FromInternalValue(1),
108 base::TimeTicks::FromInternalValue(2),
109 base::TimeDelta::FromInternalValue(3), BeginFrameArgs::NORMAL);
110 proto::BeginFrameArgs proto;
111 args.ToProtobuf(&proto);
112
113 BeginFrameArgs new_args;
114 new_args.FromProtobuf(proto);
115
116 EXPECT_EQ(args, new_args);
117 }
118
119 #ifndef NDEBUG 87 #ifndef NDEBUG
120 TEST(BeginFrameArgsTest, Location) { 88 TEST(BeginFrameArgsTest, Location) {
121 tracked_objects::Location expected_location = BEGINFRAME_FROM_HERE; 89 tracked_objects::Location expected_location = BEGINFRAME_FROM_HERE;
122 90
123 BeginFrameArgs args = CreateBeginFrameArgsForTesting(expected_location); 91 BeginFrameArgs args = CreateBeginFrameArgsForTesting(expected_location);
124 EXPECT_EQ(expected_location.ToString(), args.created_from.ToString()); 92 EXPECT_EQ(expected_location.ToString(), args.created_from.ToString());
125 } 93 }
126 #endif 94 #endif
127 95
128 } // namespace 96 } // namespace
129 } // namespace cc 97 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/begin_frame_args.cc ('k') | cc/output/managed_memory_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698