Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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.h" | 5 #include "cc/layers/layer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "cc/animation/animation_host.h" | 10 #include "cc/animation/animation_host.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 using ::testing::StrictMock; | 46 using ::testing::StrictMock; |
| 47 using ::testing::_; | 47 using ::testing::_; |
| 48 | 48 |
| 49 #define EXPECT_SET_NEEDS_FULL_TREE_SYNC(expect, code_to_test) \ | 49 #define EXPECT_SET_NEEDS_FULL_TREE_SYNC(expect, code_to_test) \ |
| 50 do { \ | 50 do { \ |
| 51 EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times((expect)); \ | 51 EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times((expect)); \ |
| 52 code_to_test; \ | 52 code_to_test; \ |
| 53 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ | 53 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ |
| 54 } while (false) | 54 } while (false) |
| 55 | 55 |
| 56 #define EXECUTE_AND_VERIFY_SUBTREE_CHANGED(code_to_test) \ | 56 #define EXECUTE_AND_VERIFY_SUBTREE_CHANGED(code_to_test) \ |
| 57 code_to_test; \ | 57 code_to_test; \ |
| 58 root->layer_tree_host()->BuildPropertyTreesForTesting(); \ | 58 root->layer_tree_host()->BuildPropertyTreesForTesting(); \ |
| 59 EXPECT_TRUE(root->subtree_property_changed()); \ | 59 EXPECT_TRUE(root->subtree_property_changed()); \ |
| 60 EXPECT_TRUE(root->needs_push_properties()); \ | 60 EXPECT_TRUE(root->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \ |
| 61 EXPECT_TRUE(child->subtree_property_changed()); \ | 61 root.get())); \ |
| 62 EXPECT_TRUE(child->needs_push_properties()); \ | 62 EXPECT_TRUE(child->subtree_property_changed()); \ |
| 63 EXPECT_TRUE(grand_child->subtree_property_changed()); \ | 63 EXPECT_TRUE(child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \ |
| 64 EXPECT_TRUE(grand_child->needs_push_properties()); | 64 child.get())); \ |
| 65 EXPECT_TRUE(grand_child->subtree_property_changed()); \ | |
| 66 EXPECT_TRUE( \ | |
| 67 grand_child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \ | |
| 68 grand_child.get())); | |
| 65 | 69 |
| 66 #define EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(code_to_test) \ | 70 #define EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(code_to_test) \ |
| 67 code_to_test; \ | 71 code_to_test; \ |
| 68 EXPECT_FALSE(root->subtree_property_changed()); \ | 72 EXPECT_FALSE(root->subtree_property_changed()); \ |
| 69 EXPECT_FALSE(root->needs_push_properties()); \ | 73 EXPECT_FALSE(root->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \ |
| 70 EXPECT_FALSE(child->subtree_property_changed()); \ | 74 root.get())); \ |
| 71 EXPECT_FALSE(child->needs_push_properties()); \ | 75 EXPECT_FALSE(child->subtree_property_changed()); \ |
| 72 EXPECT_FALSE(grand_child->subtree_property_changed()); \ | 76 EXPECT_FALSE(child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \ |
| 73 EXPECT_FALSE(grand_child->needs_push_properties()); | 77 child.get())); \ |
| 78 EXPECT_FALSE(grand_child->subtree_property_changed()); \ | |
| 79 EXPECT_FALSE( \ | |
| 80 grand_child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \ | |
| 81 grand_child.get())); | |
| 74 | 82 |
| 75 namespace cc { | 83 namespace cc { |
| 76 | 84 |
| 77 // This class is a friend of Layer, and is used as a wrapper for all the tests | 85 // This class is a friend of Layer, and is used as a wrapper for all the tests |
| 78 // related to proto serialization. This is done so that it is unnecessary to | 86 // related to proto serialization. This is done so that it is unnecessary to |
| 79 // add FRIEND_TEST_ALL_PREFIXES in //cc/layers/layer.h for all the tests. | 87 // add FRIEND_TEST_ALL_PREFIXES in //cc/layers/layer.h for all the tests. |
| 80 // It is in the cc namespace so that it can be a friend of Layer. | 88 // It is in the cc namespace so that it can be a friend of Layer. |
| 81 // The tests still have helpful names, and a test with the name FooBar would | 89 // The tests still have helpful names, and a test with the name FooBar would |
| 82 // have a wrapper method in this class called RunFooBarTest. | 90 // have a wrapper method in this class called RunFooBarTest. |
| 83 class LayerSerializationTest : public testing::Test { | 91 class LayerSerializationTest : public testing::Test { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 103 src->SetLayerTreeHost(layer_tree_host_.get()); | 111 src->SetLayerTreeHost(layer_tree_host_.get()); |
| 104 | 112 |
| 105 // The following member is reset during serialization, so store the original | 113 // The following member is reset during serialization, so store the original |
| 106 // values. | 114 // values. |
| 107 gfx::Rect update_rect = src->update_rect_; | 115 gfx::Rect update_rect = src->update_rect_; |
| 108 | 116 |
| 109 // Serialize |src| to protobuf and read the first entry in the | 117 // Serialize |src| to protobuf and read the first entry in the |
| 110 // LayerUpdate. There are no descendants, so the serialization | 118 // LayerUpdate. There are no descendants, so the serialization |
| 111 // of |src| is the only entry. | 119 // of |src| is the only entry. |
| 112 proto::LayerUpdate layer_update; | 120 proto::LayerUpdate layer_update; |
| 113 EXPECT_FALSE(src->ToLayerPropertiesProto(&layer_update)); | 121 src->ToLayerPropertiesProto(&layer_update); |
| 114 ASSERT_EQ(1, layer_update.layers_size()); | 122 ASSERT_EQ(1, layer_update.layers_size()); |
| 115 proto::LayerProperties props = layer_update.layers(0); | 123 proto::LayerProperties props = layer_update.layers(0); |
| 116 | 124 |
| 117 // The |dest| layer needs to be able to lookup the scroll and clip parents. | 125 // The |dest| layer needs to be able to lookup the scroll and clip parents. |
| 118 if (src->scroll_parent_) | 126 if (src->scroll_parent_) |
| 119 layer_tree_host_->RegisterLayer(src->scroll_parent_); | 127 layer_tree_host_->RegisterLayer(src->scroll_parent_); |
| 120 if (src->scroll_children_) { | 128 if (src->scroll_children_) { |
| 121 for (auto* child : *(src->scroll_children_)) | 129 for (auto* child : *(src->scroll_children_)) |
| 122 layer_tree_host_->RegisterLayer(child); | 130 layer_tree_host_->RegisterLayer(child); |
| 123 } | 131 } |
| (...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1331 EXPECT_EQ(child2, parent->children()[1]); | 1339 EXPECT_EQ(child2, parent->children()[1]); |
| 1332 | 1340 |
| 1333 EXPECT_SET_NEEDS_COMMIT(2, child1->SetScrollParent(child2.get())); | 1341 EXPECT_SET_NEEDS_COMMIT(2, child1->SetScrollParent(child2.get())); |
| 1334 | 1342 |
| 1335 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, child2->RemoveFromParent()); | 1343 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, child2->RemoveFromParent()); |
| 1336 | 1344 |
| 1337 child1->reset_needs_push_properties_for_testing(); | 1345 child1->reset_needs_push_properties_for_testing(); |
| 1338 | 1346 |
| 1339 EXPECT_SET_NEEDS_COMMIT(1, child2 = nullptr); | 1347 EXPECT_SET_NEEDS_COMMIT(1, child2 = nullptr); |
| 1340 | 1348 |
| 1341 EXPECT_TRUE(child1->needs_push_properties()); | 1349 EXPECT_TRUE( |
| 1350 layer_tree_host_->LayerNeedsPushPropertiesForTesting(child1.get())); | |
| 1342 | 1351 |
| 1343 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr)); | 1352 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr)); |
| 1344 } | 1353 } |
| 1345 | 1354 |
| 1346 TEST_F(LayerTest, DeleteRemovedScrollChild) { | 1355 TEST_F(LayerTest, DeleteRemovedScrollChild) { |
| 1347 scoped_refptr<Layer> parent = Layer::Create(layer_settings_); | 1356 scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
| 1348 scoped_refptr<Layer> child1 = Layer::Create(layer_settings_); | 1357 scoped_refptr<Layer> child1 = Layer::Create(layer_settings_); |
| 1349 scoped_refptr<Layer> child2 = Layer::Create(layer_settings_); | 1358 scoped_refptr<Layer> child2 = Layer::Create(layer_settings_); |
| 1350 | 1359 |
| 1351 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); | 1360 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); |
| 1352 | 1361 |
| 1353 ASSERT_EQ(0U, parent->children().size()); | 1362 ASSERT_EQ(0U, parent->children().size()); |
| 1354 | 1363 |
| 1355 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, parent->InsertChild(child1, 0)); | 1364 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, parent->InsertChild(child1, 0)); |
| 1356 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, parent->InsertChild(child2, 1)); | 1365 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, parent->InsertChild(child2, 1)); |
| 1357 | 1366 |
| 1358 ASSERT_EQ(2U, parent->children().size()); | 1367 ASSERT_EQ(2U, parent->children().size()); |
| 1359 EXPECT_EQ(child1, parent->children()[0]); | 1368 EXPECT_EQ(child1, parent->children()[0]); |
| 1360 EXPECT_EQ(child2, parent->children()[1]); | 1369 EXPECT_EQ(child2, parent->children()[1]); |
| 1361 | 1370 |
| 1362 EXPECT_SET_NEEDS_COMMIT(2, child1->SetScrollParent(child2.get())); | 1371 EXPECT_SET_NEEDS_COMMIT(2, child1->SetScrollParent(child2.get())); |
| 1363 | 1372 |
| 1364 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, child1->RemoveFromParent()); | 1373 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, child1->RemoveFromParent()); |
| 1365 | 1374 |
| 1366 child2->reset_needs_push_properties_for_testing(); | 1375 child2->reset_needs_push_properties_for_testing(); |
| 1367 | 1376 |
| 1368 EXPECT_SET_NEEDS_COMMIT(1, child1 = nullptr); | 1377 EXPECT_SET_NEEDS_COMMIT(1, child1 = nullptr); |
| 1369 | 1378 |
| 1370 EXPECT_TRUE(child2->needs_push_properties()); | 1379 EXPECT_TRUE( |
| 1380 layer_tree_host_->LayerNeedsPushPropertiesForTesting(child2.get())); | |
| 1371 | 1381 |
| 1372 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr)); | 1382 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr)); |
| 1373 } | 1383 } |
| 1374 | 1384 |
| 1375 TEST_F(LayerTest, ReplaceChildWithSameChild) { | 1385 TEST_F(LayerTest, ReplaceChildWithSameChild) { |
| 1376 CreateSimpleTestTree(); | 1386 CreateSimpleTestTree(); |
| 1377 | 1387 |
| 1378 // SetNeedsFullTreeSync / SetNeedsCommit should not be called because its the | 1388 // SetNeedsFullTreeSync / SetNeedsCommit should not be called because its the |
| 1379 // same child. | 1389 // same child. |
| 1380 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(0); | 1390 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(0); |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2502 TEST_F(LayerSerializationTest, | 2512 TEST_F(LayerSerializationTest, |
| 2503 NonDestructiveDeserializationMoveChildEarlierTest) { | 2513 NonDestructiveDeserializationMoveChildEarlierTest) { |
| 2504 RunNonDestructiveDeserializationMoveChildEarlierTest(); | 2514 RunNonDestructiveDeserializationMoveChildEarlierTest(); |
| 2505 } | 2515 } |
| 2506 | 2516 |
| 2507 TEST_F(LayerSerializationTest, | 2517 TEST_F(LayerSerializationTest, |
| 2508 NonDestructiveDeserializationMoveChildLaterTest) { | 2518 NonDestructiveDeserializationMoveChildLaterTest) { |
| 2509 RunNonDestructiveDeserializationMoveChildLaterTest(); | 2519 RunNonDestructiveDeserializationMoveChildLaterTest(); |
| 2510 } | 2520 } |
| 2511 | 2521 |
| 2512 TEST_F(LayerTest, SimplePropertiesSerialization) { | |
|
jaydasika
2016/03/17 23:38:37
Deleted this as what gets serialized is no longer
| |
| 2513 /* Testing serialization of properties for a tree that looks like this: | |
| 2514 root+ | |
| 2515 / \ | |
| 2516 a* b*+[mask:*,replica] | |
| 2517 / \ | |
| 2518 c d* | |
| 2519 Layers marked with * have changed properties. | |
| 2520 Layers marked with + have descendants with changed properties. | |
| 2521 Layer b also has a mask layer and a replica layer. | |
| 2522 */ | |
| 2523 scoped_refptr<Layer> layer_src_root = Layer::Create(LayerSettings()); | |
| 2524 scoped_refptr<Layer> layer_src_a = Layer::Create(LayerSettings()); | |
| 2525 scoped_refptr<Layer> layer_src_b = Layer::Create(LayerSettings()); | |
| 2526 scoped_refptr<Layer> layer_src_b_mask = Layer::Create(LayerSettings()); | |
| 2527 scoped_refptr<Layer> layer_src_b_replica = Layer::Create(LayerSettings()); | |
| 2528 scoped_refptr<Layer> layer_src_c = Layer::Create(LayerSettings()); | |
| 2529 scoped_refptr<Layer> layer_src_d = Layer::Create(LayerSettings()); | |
| 2530 layer_src_root->AddChild(layer_src_a); | |
| 2531 layer_src_root->AddChild(layer_src_b); | |
| 2532 layer_src_a->AddChild(layer_src_c); | |
| 2533 layer_src_b->AddChild(layer_src_d); | |
| 2534 layer_src_b->SetMaskLayer(layer_src_b_mask.get()); | |
| 2535 layer_src_b->SetReplicaLayer(layer_src_b_replica.get()); | |
| 2536 | |
| 2537 proto::LayerUpdate layer_update_root; | |
| 2538 // Only layers with descendants that require pushing properties will | |
| 2539 // return true from ToLayerPropertiesProto and AddChild will change the | |
| 2540 // stacking order of child which will make it push properties. | |
| 2541 EXPECT_TRUE(layer_src_root->ToLayerPropertiesProto(&layer_update_root)); | |
| 2542 proto::LayerUpdate layer_update_a; | |
| 2543 EXPECT_TRUE(layer_src_a->ToLayerPropertiesProto(&layer_update_a)); | |
| 2544 proto::LayerUpdate layer_update_b; | |
| 2545 EXPECT_TRUE(layer_src_b->ToLayerPropertiesProto(&layer_update_b)); | |
| 2546 proto::LayerUpdate layer_update_c; | |
| 2547 EXPECT_FALSE(layer_src_c->ToLayerPropertiesProto(&layer_update_c)); | |
| 2548 proto::LayerUpdate layer_update_d; | |
| 2549 EXPECT_FALSE(layer_src_d->ToLayerPropertiesProto(&layer_update_d)); | |
| 2550 layer_update_root.Clear(); | |
| 2551 layer_update_a.Clear(); | |
| 2552 layer_update_b.Clear(); | |
| 2553 layer_update_c.Clear(); | |
| 2554 layer_update_d.Clear(); | |
| 2555 | |
| 2556 layer_src_a->SetNeedsPushProperties(); | |
| 2557 layer_src_b->SetNeedsPushProperties(); | |
| 2558 layer_src_b_mask->SetNeedsPushProperties(); | |
| 2559 layer_src_d->SetNeedsPushProperties(); | |
| 2560 | |
| 2561 // Only layers with descendants that require pushing properties will | |
| 2562 // return true from ToLayerPropertiesProto. | |
| 2563 EXPECT_TRUE(layer_src_root->ToLayerPropertiesProto(&layer_update_root)); | |
| 2564 EXPECT_FALSE(layer_src_a->ToLayerPropertiesProto(&layer_update_a)); | |
| 2565 EXPECT_TRUE(layer_src_b->ToLayerPropertiesProto(&layer_update_b)); | |
| 2566 proto::LayerUpdate layer_update_b_mask; | |
| 2567 EXPECT_FALSE(layer_src_b_mask->ToLayerPropertiesProto(&layer_update_b_mask)); | |
| 2568 proto::LayerUpdate layer_update_b_replica; | |
| 2569 EXPECT_FALSE( | |
| 2570 layer_src_b_replica->ToLayerPropertiesProto(&layer_update_b_replica)); | |
| 2571 EXPECT_FALSE(layer_src_c->ToLayerPropertiesProto(&layer_update_c)); | |
| 2572 EXPECT_FALSE(layer_src_d->ToLayerPropertiesProto(&layer_update_d)); | |
| 2573 | |
| 2574 // All flags for pushing properties should have been cleared. | |
| 2575 EXPECT_FALSE(layer_src_root->needs_push_properties()); | |
| 2576 EXPECT_FALSE(layer_src_root->descendant_needs_push_properties()); | |
| 2577 EXPECT_FALSE(layer_src_a->needs_push_properties()); | |
| 2578 EXPECT_FALSE(layer_src_a->descendant_needs_push_properties()); | |
| 2579 EXPECT_FALSE(layer_src_b->needs_push_properties()); | |
| 2580 EXPECT_FALSE(layer_src_b->descendant_needs_push_properties()); | |
| 2581 EXPECT_FALSE(layer_src_b_mask->needs_push_properties()); | |
| 2582 EXPECT_FALSE(layer_src_b_mask->descendant_needs_push_properties()); | |
| 2583 EXPECT_FALSE(layer_src_b_replica->needs_push_properties()); | |
| 2584 EXPECT_FALSE(layer_src_b_replica->descendant_needs_push_properties()); | |
| 2585 EXPECT_FALSE(layer_src_c->needs_push_properties()); | |
| 2586 EXPECT_FALSE(layer_src_c->descendant_needs_push_properties()); | |
| 2587 EXPECT_FALSE(layer_src_d->needs_push_properties()); | |
| 2588 EXPECT_FALSE(layer_src_d->descendant_needs_push_properties()); | |
| 2589 | |
| 2590 // Only 5 of the layers should have been serialized. | |
| 2591 ASSERT_EQ(1, layer_update_root.layers_size()); | |
| 2592 EXPECT_EQ(layer_src_root->id(), layer_update_root.layers(0).id()); | |
| 2593 proto::LayerProperties dest_root = layer_update_root.layers(0); | |
| 2594 ASSERT_EQ(1, layer_update_a.layers_size()); | |
| 2595 EXPECT_EQ(layer_src_a->id(), layer_update_a.layers(0).id()); | |
| 2596 proto::LayerProperties dest_a = layer_update_a.layers(0); | |
| 2597 ASSERT_EQ(1, layer_update_b.layers_size()); | |
| 2598 EXPECT_EQ(layer_src_b->id(), layer_update_b.layers(0).id()); | |
| 2599 proto::LayerProperties dest_b = layer_update_b.layers(0); | |
| 2600 ASSERT_EQ(1, layer_update_b_mask.layers_size()); | |
| 2601 EXPECT_EQ(layer_src_b_mask->id(), layer_update_b_mask.layers(0).id()); | |
| 2602 proto::LayerProperties dest_b_mask = layer_update_b_mask.layers(0); | |
| 2603 EXPECT_EQ(0, layer_update_b_replica.layers_size()); | |
| 2604 EXPECT_EQ(0, layer_update_c.layers_size()); | |
| 2605 ASSERT_EQ(1, layer_update_d.layers_size()); | |
| 2606 EXPECT_EQ(layer_src_d->id(), layer_update_d.layers(0).id()); | |
| 2607 proto::LayerProperties dest_d = layer_update_d.layers(0); | |
| 2608 | |
| 2609 // Ensure the properties and dependants metadata is correctly serialized. | |
| 2610 EXPECT_FALSE(dest_root.needs_push_properties()); | |
| 2611 EXPECT_EQ(2, dest_root.num_dependents_need_push_properties()); | |
| 2612 EXPECT_FALSE(dest_root.has_base()); | |
| 2613 | |
| 2614 EXPECT_TRUE(dest_a.needs_push_properties()); | |
| 2615 EXPECT_EQ(0, dest_a.num_dependents_need_push_properties()); | |
| 2616 EXPECT_TRUE(dest_a.has_base()); | |
| 2617 | |
| 2618 EXPECT_TRUE(dest_b.needs_push_properties()); | |
| 2619 EXPECT_EQ(2, dest_b.num_dependents_need_push_properties()); | |
| 2620 EXPECT_TRUE(dest_b.has_base()); | |
| 2621 | |
| 2622 EXPECT_TRUE(dest_d.needs_push_properties()); | |
| 2623 EXPECT_EQ(0, dest_d.num_dependents_need_push_properties()); | |
| 2624 EXPECT_TRUE(dest_d.has_base()); | |
| 2625 | |
| 2626 EXPECT_TRUE(dest_b_mask.needs_push_properties()); | |
| 2627 EXPECT_EQ(0, dest_b_mask.num_dependents_need_push_properties()); | |
| 2628 EXPECT_TRUE(dest_b_mask.has_base()); | |
| 2629 } | |
| 2630 | |
| 2631 TEST_F(LayerSerializationTest, SimplePropertiesDeserialization) { | |
| 2632 scoped_refptr<Layer> layer = Layer::Create(LayerSettings()); | |
| 2633 layer->SetLayerTreeHost(layer_tree_host_.get()); | |
| 2634 proto::LayerProperties properties; | |
| 2635 properties.set_id(layer->id()); | |
| 2636 | |
| 2637 properties.set_needs_push_properties(true); | |
| 2638 properties.set_num_dependents_need_push_properties(2); | |
| 2639 properties.mutable_base(); | |
| 2640 layer->FromLayerPropertiesProto(properties); | |
| 2641 EXPECT_TRUE(layer->needs_push_properties()); | |
| 2642 EXPECT_TRUE(layer->descendant_needs_push_properties()); | |
| 2643 | |
| 2644 properties.set_needs_push_properties(false); | |
| 2645 properties.mutable_base()->Clear(); | |
| 2646 layer->FromLayerPropertiesProto(properties); | |
| 2647 EXPECT_FALSE(layer->needs_push_properties()); | |
| 2648 EXPECT_TRUE(layer->descendant_needs_push_properties()); | |
| 2649 | |
| 2650 properties.set_num_dependents_need_push_properties(0); | |
| 2651 layer->FromLayerPropertiesProto(properties); | |
| 2652 EXPECT_FALSE(layer->needs_push_properties()); | |
| 2653 EXPECT_FALSE(layer->descendant_needs_push_properties()); | |
| 2654 | |
| 2655 properties.set_needs_push_properties(true); | |
| 2656 properties.mutable_base(); | |
| 2657 layer->FromLayerPropertiesProto(properties); | |
| 2658 EXPECT_TRUE(layer->needs_push_properties()); | |
| 2659 EXPECT_FALSE(layer->descendant_needs_push_properties()); | |
| 2660 | |
| 2661 layer->SetLayerTreeHost(nullptr); | |
| 2662 } | |
| 2663 | |
| 2664 TEST_F(LayerSerializationTest, NoMembersChanged) { | 2522 TEST_F(LayerSerializationTest, NoMembersChanged) { |
| 2665 RunNoMembersChangedTest(); | 2523 RunNoMembersChangedTest(); |
| 2666 } | 2524 } |
| 2667 | 2525 |
| 2668 TEST_F(LayerSerializationTest, ArbitraryMembersChanged) { | 2526 TEST_F(LayerSerializationTest, ArbitraryMembersChanged) { |
| 2669 RunArbitraryMembersChangedTest(); | 2527 RunArbitraryMembersChangedTest(); |
| 2670 } | 2528 } |
| 2671 | 2529 |
| 2672 TEST_F(LayerSerializationTest, AllMembersChanged) { | 2530 TEST_F(LayerSerializationTest, AllMembersChanged) { |
| 2673 RunAllMembersChangedTest(); | 2531 RunAllMembersChangedTest(); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 2694 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); | 2552 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); |
| 2695 | 2553 |
| 2696 test_layer->PushPropertiesTo(impl_layer.get()); | 2554 test_layer->PushPropertiesTo(impl_layer.get()); |
| 2697 | 2555 |
| 2698 EXPECT_EQ(2lu, impl_layer->element_id()); | 2556 EXPECT_EQ(2lu, impl_layer->element_id()); |
| 2699 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); | 2557 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); |
| 2700 } | 2558 } |
| 2701 | 2559 |
| 2702 } // namespace | 2560 } // namespace |
| 2703 } // namespace cc | 2561 } // namespace cc |
| OLD | NEW |