OLD | NEW |
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 "cc/trees/property_tree.h" | 5 #include "cc/trees/property_tree.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | |
8 #include "cc/input/main_thread_scrolling_reason.h" | 7 #include "cc/input/main_thread_scrolling_reason.h" |
9 #include "cc/proto/property_tree.pb.h" | 8 #include "cc/proto/property_tree.pb.h" |
10 #include "cc/test/geometry_test_utils.h" | 9 #include "cc/test/geometry_test_utils.h" |
11 #include "cc/trees/clip_node.h" | 10 #include "cc/trees/clip_node.h" |
12 #include "cc/trees/draw_property_utils.h" | 11 #include "cc/trees/draw_property_utils.h" |
13 #include "cc/trees/effect_node.h" | 12 #include "cc/trees/effect_node.h" |
14 #include "cc/trees/scroll_node.h" | 13 #include "cc/trees/scroll_node.h" |
15 #include "cc/trees/transform_node.h" | 14 #include "cc/trees/transform_node.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
17 | 16 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 original.resets_clip = false; | 119 original.resets_clip = false; |
121 | 120 |
122 proto::TreeNode proto; | 121 proto::TreeNode proto; |
123 original.ToProtobuf(&proto); | 122 original.ToProtobuf(&proto); |
124 ClipNode result; | 123 ClipNode result; |
125 result.FromProtobuf(proto); | 124 result.FromProtobuf(proto); |
126 | 125 |
127 EXPECT_EQ(original, result); | 126 EXPECT_EQ(original, result); |
128 } | 127 } |
129 | 128 |
130 TEST(PropertyTreeSerializationTest, ClipNodeWithExpanderSerialization) { | |
131 ClipNode original; | |
132 original.id = 3; | |
133 original.parent_id = 2; | |
134 original.owner_id = 4; | |
135 original.clip = gfx::RectF(0.5f, 0.5f); | |
136 original.combined_clip_in_target_space = gfx::RectF(0.6f, 0.6f); | |
137 original.clip_in_target_space = gfx::RectF(0.7f, 0.7f); | |
138 original.transform_id = 2; | |
139 original.target_transform_id = 3; | |
140 original.target_effect_id = 4; | |
141 original.clip_type = ClipNode::ClipType::EXPANDS_CLIP; | |
142 original.clip_expander = base::MakeUnique<ClipExpander>(8); | |
143 original.layer_clipping_uses_only_local_clip = false; | |
144 original.target_is_clipped = false; | |
145 original.layers_are_clipped = false; | |
146 original.layers_are_clipped_when_surfaces_disabled = false; | |
147 original.resets_clip = false; | |
148 | |
149 proto::TreeNode proto; | |
150 original.ToProtobuf(&proto); | |
151 ClipNode result; | |
152 result.FromProtobuf(proto); | |
153 | |
154 EXPECT_EQ(original, result); | |
155 } | |
156 | |
157 TEST(PropertyTreeSerializationTest, ClipTreeSerialization) { | 129 TEST(PropertyTreeSerializationTest, ClipTreeSerialization) { |
158 ClipTree original; | 130 ClipTree original; |
159 ClipNode& root = *original.Node(0); | 131 ClipNode& root = *original.Node(0); |
160 root.owner_id = 1; | 132 root.owner_id = 1; |
161 root.transform_id = 2; | 133 root.transform_id = 2; |
162 root.target_transform_id = 1; | 134 root.target_transform_id = 1; |
163 root.target_effect_id = 1; | 135 root.target_effect_id = 1; |
164 ClipNode second; | 136 ClipNode second; |
165 second.owner_id = 2; | 137 second.owner_id = 2; |
166 second.transform_id = 4; | 138 second.transform_id = 4; |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 | 1021 |
1050 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 1022 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
1051 PropertyTreeTestSingularTransformSnapTest); | 1023 PropertyTreeTestSingularTransformSnapTest); |
1052 | 1024 |
1053 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F | 1025 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F |
1054 #undef SERIALIZED_PROPERTY_TREE_TEST_F | 1026 #undef SERIALIZED_PROPERTY_TREE_TEST_F |
1055 #undef DIRECT_PROPERTY_TREE_TEST_F | 1027 #undef DIRECT_PROPERTY_TREE_TEST_F |
1056 | 1028 |
1057 } // namespace | 1029 } // namespace |
1058 } // namespace cc | 1030 } // namespace cc |
OLD | NEW |