| 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 "cc/input/main_thread_scrolling_reason.h" | 7 #include "cc/input/main_thread_scrolling_reason.h" |
| 8 #include "cc/proto/property_tree.pb.h" | 8 #include "cc/proto/property_tree.pb.h" |
| 9 #include "cc/test/geometry_test_utils.h" | 9 #include "cc/test/geometry_test_utils.h" |
| 10 #include "cc/trees/draw_property_utils.h" | 10 #include "cc/trees/draw_property_utils.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 EXPECT_EQ(original, result); | 180 EXPECT_EQ(original, result); |
| 181 } | 181 } |
| 182 | 182 |
| 183 TEST(PropertyTreeSerializationTest, EffectNodeDataSerialization) { | 183 TEST(PropertyTreeSerializationTest, EffectNodeDataSerialization) { |
| 184 EffectNodeData original; | 184 EffectNodeData original; |
| 185 original.opacity = 0.5f; | 185 original.opacity = 0.5f; |
| 186 original.screen_space_opacity = 0.6f; | 186 original.screen_space_opacity = 0.6f; |
| 187 original.has_render_surface = false; | 187 original.has_render_surface = false; |
| 188 original.transform_id = 2; | 188 original.transform_id = 2; |
| 189 original.clip_id = 3; | 189 original.clip_id = 3; |
| 190 original.mask_layer_id = 6; |
| 191 original.replica_layer_id = 10; |
| 192 original.replica_mask_layer_id = 9; |
| 190 | 193 |
| 191 proto::TreeNode proto; | 194 proto::TreeNode proto; |
| 192 original.ToProtobuf(&proto); | 195 original.ToProtobuf(&proto); |
| 193 EffectNodeData result; | 196 EffectNodeData result; |
| 194 result.FromProtobuf(proto); | 197 result.FromProtobuf(proto); |
| 195 | 198 |
| 196 EXPECT_EQ(original, result); | 199 EXPECT_EQ(original, result); |
| 197 } | 200 } |
| 198 | 201 |
| 199 TEST(PropertyTreeSerializationTest, EffectNodeSerialization) { | 202 TEST(PropertyTreeSerializationTest, EffectNodeSerialization) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 213 TEST(PropertyTreeSerializationTest, EffectTreeSerialization) { | 216 TEST(PropertyTreeSerializationTest, EffectTreeSerialization) { |
| 214 EffectTree original; | 217 EffectTree original; |
| 215 EffectNode& root = *original.Node(0); | 218 EffectNode& root = *original.Node(0); |
| 216 root.owner_id = 5; | 219 root.owner_id = 5; |
| 217 root.data.transform_id = 2; | 220 root.data.transform_id = 2; |
| 218 root.data.clip_id = 1; | 221 root.data.clip_id = 1; |
| 219 EffectNode second; | 222 EffectNode second; |
| 220 second.owner_id = 6; | 223 second.owner_id = 6; |
| 221 second.data.transform_id = 4; | 224 second.data.transform_id = 4; |
| 222 second.data.opacity = true; | 225 second.data.opacity = true; |
| 226 second.data.mask_layer_id = 32; |
| 223 EffectNode third; | 227 EffectNode third; |
| 224 third.owner_id = 7; | 228 third.owner_id = 7; |
| 225 third.data.clip_id = 3; | 229 third.data.clip_id = 3; |
| 230 third.data.replica_layer_id = 44; |
| 231 third.data.replica_mask_layer_id = 45; |
| 226 third.data.has_render_surface = false; | 232 third.data.has_render_surface = false; |
| 227 | 233 |
| 228 original.Insert(second, 0); | 234 original.Insert(second, 0); |
| 229 original.Insert(third, 1); | 235 original.Insert(third, 1); |
| 236 original.AddMaskOrReplicaLayerId(32); |
| 237 original.AddMaskOrReplicaLayerId(44); |
| 238 original.AddMaskOrReplicaLayerId(45); |
| 230 original.set_needs_update(true); | 239 original.set_needs_update(true); |
| 231 | 240 |
| 232 proto::PropertyTree proto; | 241 proto::PropertyTree proto; |
| 233 original.ToProtobuf(&proto); | 242 original.ToProtobuf(&proto); |
| 234 EffectTree result; | 243 EffectTree result; |
| 235 std::unordered_map<int, int> effect_id_to_index_map; | 244 std::unordered_map<int, int> effect_id_to_index_map; |
| 236 result.FromProtobuf(proto, &effect_id_to_index_map); | 245 result.FromProtobuf(proto, &effect_id_to_index_map); |
| 237 | 246 |
| 238 EXPECT_EQ(effect_id_to_index_map[5], 0); | 247 EXPECT_EQ(effect_id_to_index_map[5], 0); |
| 239 EXPECT_EQ(effect_id_to_index_map[6], 1); | 248 EXPECT_EQ(effect_id_to_index_map[6], 1); |
| (...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 | 1155 |
| 1147 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 1156 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 1148 PropertyTreeTestSingularTransformSnapTest); | 1157 PropertyTreeTestSingularTransformSnapTest); |
| 1149 | 1158 |
| 1150 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F | 1159 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F |
| 1151 #undef SERIALIZED_PROPERTY_TREE_TEST_F | 1160 #undef SERIALIZED_PROPERTY_TREE_TEST_F |
| 1152 #undef DIRECT_PROPERTY_TREE_TEST_F | 1161 #undef DIRECT_PROPERTY_TREE_TEST_F |
| 1153 | 1162 |
| 1154 } // namespace | 1163 } // namespace |
| 1155 } // namespace cc | 1164 } // namespace cc |
| OLD | NEW |