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

Side by Side Diff: cc/layers/layer_position_constraint_unittest.cc

Issue 2646623002: cc: Remove all blimp code from cc. (Closed)
Patch Set: test build Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « cc/layers/layer_position_constraint.cc ('k') | cc/layers/layer_sticky_position_constraint.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/layers/layer_position_constraint.h" 5 #include "cc/layers/layer_position_constraint.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "cc/animation/animation_host.h" 9 #include "cc/animation/animation_host.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
11 #include "cc/layers/layer_impl.h" 11 #include "cc/layers/layer_impl.h"
12 #include "cc/proto/layer_position_constraint.pb.h"
13 #include "cc/test/fake_layer_tree_host.h" 12 #include "cc/test/fake_layer_tree_host.h"
14 #include "cc/test/fake_proxy.h" 13 #include "cc/test/fake_proxy.h"
15 #include "cc/test/geometry_test_utils.h" 14 #include "cc/test/geometry_test_utils.h"
16 #include "cc/test/test_task_graph_runner.h" 15 #include "cc/test/test_task_graph_runner.h"
17 #include "cc/trees/layer_tree_host_common.h" 16 #include "cc/trees/layer_tree_host_common.h"
18 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
19 18
20 namespace cc { 19 namespace cc {
21 namespace { 20 namespace {
22 21
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 expected_fixed_child_transform.MakeIdentity(); 1139 expected_fixed_child_transform.MakeIdentity();
1141 // Apply size delta. 1140 // Apply size delta.
1142 expected_fixed_child_transform.Translate(20.0, 20.0); 1141 expected_fixed_child_transform.Translate(20.0, 20.0);
1143 1142
1144 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_scroll_layer_transform, 1143 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_scroll_layer_transform,
1145 scroll_layer_impl_->DrawTransform()); 1144 scroll_layer_impl_->DrawTransform());
1146 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_fixed_child_transform, 1145 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_fixed_child_transform,
1147 fixed_child_impl->DrawTransform()); 1146 fixed_child_impl->DrawTransform());
1148 } 1147 }
1149 1148
1150 void VerifySerializeAndDeserializeProto(bool is_fixed_position,
1151 bool is_fixed_to_right_edge,
1152 bool is_fixed_to_bottom_edge) {
1153 LayerPositionConstraint constraint;
1154 constraint.set_is_fixed_position(is_fixed_position);
1155 constraint.set_is_fixed_to_right_edge(is_fixed_to_right_edge);
1156 constraint.set_is_fixed_to_bottom_edge(is_fixed_to_bottom_edge);
1157 proto::LayerPositionConstraint proto;
1158 constraint.ToProtobuf(&proto);
1159
1160 LayerPositionConstraint constraint2;
1161 constraint2.FromProtobuf(proto);
1162 EXPECT_EQ(constraint, constraint2);
1163 }
1164
1165 TEST(LayerPositionConstraintSerializationTest, SerializeAndDeserializeProto) {
1166 VerifySerializeAndDeserializeProto(true, true, true);
1167 VerifySerializeAndDeserializeProto(true, true, false);
1168 VerifySerializeAndDeserializeProto(true, false, true);
1169 VerifySerializeAndDeserializeProto(true, false, false);
1170 VerifySerializeAndDeserializeProto(false, true, true);
1171 VerifySerializeAndDeserializeProto(false, true, false);
1172 VerifySerializeAndDeserializeProto(false, false, true);
1173 VerifySerializeAndDeserializeProto(false, false, false);
1174 }
1175
1176 } // namespace 1149 } // namespace
1177 } // namespace cc 1150 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_position_constraint.cc ('k') | cc/layers/layer_sticky_position_constraint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698