| Index: cc/layers/layer_unittest.cc
|
| diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc
|
| index 179e0a50eff8e70f516d90a8e95b500a330eb2f7..3830c83d29dd0fca99d1f61444072401a3e83cd1 100644
|
| --- a/cc/layers/layer_unittest.cc
|
| +++ b/cc/layers/layer_unittest.cc
|
| @@ -55,49 +55,55 @@ using ::testing::_;
|
| Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \
|
| } while (false)
|
|
|
| -#define EXECUTE_AND_VERIFY_SUBTREE_CHANGED(code_to_test) \
|
| - code_to_test; \
|
| - root->layer_tree_host()->BuildPropertyTreesForTesting(); \
|
| - EXPECT_TRUE(root->subtree_property_changed()); \
|
| - EXPECT_TRUE(root->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
|
| - root.get())); \
|
| - EXPECT_TRUE(child->subtree_property_changed()); \
|
| - EXPECT_TRUE(child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
|
| - child.get())); \
|
| - EXPECT_TRUE(grand_child->subtree_property_changed()); \
|
| - EXPECT_TRUE( \
|
| - grand_child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
|
| - grand_child.get()));
|
| -
|
| -#define EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(code_to_test) \
|
| - code_to_test; \
|
| - EXPECT_FALSE(root->subtree_property_changed()); \
|
| - EXPECT_FALSE(root->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
|
| - root.get())); \
|
| - EXPECT_FALSE(child->subtree_property_changed()); \
|
| - EXPECT_FALSE(child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
|
| - child.get())); \
|
| - EXPECT_FALSE(grand_child->subtree_property_changed()); \
|
| - EXPECT_FALSE( \
|
| - grand_child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
|
| - grand_child.get()));
|
| -
|
| -#define EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(code_to_test) \
|
| - code_to_test; \
|
| - root->layer_tree_host()->BuildPropertyTreesForTesting(); \
|
| - EXPECT_TRUE(root->layer_property_changed()); \
|
| - EXPECT_FALSE(root->subtree_property_changed()); \
|
| - EXPECT_TRUE(root->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
|
| - root.get())); \
|
| - EXPECT_FALSE(child->layer_property_changed()); \
|
| - EXPECT_FALSE(child->subtree_property_changed()); \
|
| - EXPECT_FALSE(child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
|
| - child.get())); \
|
| - EXPECT_FALSE(grand_child->layer_property_changed()); \
|
| - EXPECT_FALSE(grand_child->subtree_property_changed()); \
|
| - EXPECT_FALSE( \
|
| - grand_child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
|
| - grand_child.get()));
|
| +#define EXECUTE_AND_VERIFY_SUBTREE_CHANGED(code_to_test) \
|
| + code_to_test; \
|
| + root->layer_tree_host()->BuildPropertyTreesForTesting(); \
|
| + EXPECT_TRUE(root->subtree_property_changed()); \
|
| + EXPECT_TRUE(root->layer_tree_host() \
|
| + ->GetLayerTree() \
|
| + ->LayerNeedsPushPropertiesForTesting(root.get())); \
|
| + EXPECT_TRUE(child->subtree_property_changed()); \
|
| + EXPECT_TRUE(child->layer_tree_host() \
|
| + ->GetLayerTree() \
|
| + ->LayerNeedsPushPropertiesForTesting(child.get())); \
|
| + EXPECT_TRUE(grand_child->subtree_property_changed()); \
|
| + EXPECT_TRUE(grand_child->layer_tree_host() \
|
| + ->GetLayerTree() \
|
| + ->LayerNeedsPushPropertiesForTesting(grand_child.get()));
|
| +
|
| +#define EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(code_to_test) \
|
| + code_to_test; \
|
| + EXPECT_FALSE(root->subtree_property_changed()); \
|
| + EXPECT_FALSE(root->layer_tree_host() \
|
| + ->GetLayerTree() \
|
| + ->LayerNeedsPushPropertiesForTesting(root.get())); \
|
| + EXPECT_FALSE(child->subtree_property_changed()); \
|
| + EXPECT_FALSE(child->layer_tree_host() \
|
| + ->GetLayerTree() \
|
| + ->LayerNeedsPushPropertiesForTesting(child.get())); \
|
| + EXPECT_FALSE(grand_child->subtree_property_changed()); \
|
| + EXPECT_FALSE(grand_child->layer_tree_host() \
|
| + ->GetLayerTree() \
|
| + ->LayerNeedsPushPropertiesForTesting(grand_child.get()));
|
| +
|
| +#define EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(code_to_test) \
|
| + code_to_test; \
|
| + root->layer_tree_host()->BuildPropertyTreesForTesting(); \
|
| + EXPECT_TRUE(root->layer_property_changed()); \
|
| + EXPECT_FALSE(root->subtree_property_changed()); \
|
| + EXPECT_TRUE(root->layer_tree_host() \
|
| + ->GetLayerTree() \
|
| + ->LayerNeedsPushPropertiesForTesting(root.get())); \
|
| + EXPECT_FALSE(child->layer_property_changed()); \
|
| + EXPECT_FALSE(child->subtree_property_changed()); \
|
| + EXPECT_FALSE(child->layer_tree_host() \
|
| + ->GetLayerTree() \
|
| + ->LayerNeedsPushPropertiesForTesting(child.get())); \
|
| + EXPECT_FALSE(grand_child->layer_property_changed()); \
|
| + EXPECT_FALSE(grand_child->subtree_property_changed()); \
|
| + EXPECT_FALSE(grand_child->layer_tree_host() \
|
| + ->GetLayerTree() \
|
| + ->LayerNeedsPushPropertiesForTesting(grand_child.get()));
|
|
|
| namespace cc {
|
|
|
| @@ -142,17 +148,18 @@ class LayerSerializationTest : public testing::Test {
|
| proto::LayerProperties props = layer_update.layers(0);
|
|
|
| // The |dest| layer needs to be able to lookup the scroll and clip parents.
|
| + LayerTree* layer_tree = layer_tree_host_->GetLayerTree();
|
| if (src->inputs_.scroll_parent)
|
| - layer_tree_host_->RegisterLayer(src->inputs_.scroll_parent);
|
| + layer_tree->RegisterLayer(src->inputs_.scroll_parent);
|
| if (src->scroll_children_) {
|
| for (auto* child : *(src->scroll_children_))
|
| - layer_tree_host_->RegisterLayer(child);
|
| + layer_tree->RegisterLayer(child);
|
| }
|
| if (src->inputs_.clip_parent)
|
| - layer_tree_host_->RegisterLayer(src->inputs_.clip_parent);
|
| + layer_tree->RegisterLayer(src->inputs_.clip_parent);
|
| if (src->clip_children_) {
|
| for (auto* child : *(src->clip_children_))
|
| - layer_tree_host_->RegisterLayer(child);
|
| + layer_tree->RegisterLayer(child);
|
| }
|
| // Reset the LayerTreeHost registration for the |src| layer so
|
| // it can be re-used for the |dest| layer.
|
| @@ -250,24 +257,24 @@ class LayerSerializationTest : public testing::Test {
|
|
|
| // Cleanup scroll tree.
|
| if (src->inputs_.scroll_parent)
|
| - layer_tree_host_->UnregisterLayer(src->inputs_.scroll_parent);
|
| + layer_tree->UnregisterLayer(src->inputs_.scroll_parent);
|
| src->inputs_.scroll_parent = nullptr;
|
| dest->inputs_.scroll_parent = nullptr;
|
| if (src->scroll_children_) {
|
| for (auto* child : *(src->scroll_children_))
|
| - layer_tree_host_->UnregisterLayer(child);
|
| + layer_tree->UnregisterLayer(child);
|
| src->scroll_children_.reset();
|
| dest->scroll_children_.reset();
|
| }
|
|
|
| // Cleanup clip tree.
|
| if (src->inputs_.clip_parent)
|
| - layer_tree_host_->UnregisterLayer(src->inputs_.clip_parent);
|
| + layer_tree->UnregisterLayer(src->inputs_.clip_parent);
|
| src->inputs_.clip_parent = nullptr;
|
| dest->inputs_.clip_parent = nullptr;
|
| if (src->clip_children_) {
|
| for (auto* child : *(src->clip_children_))
|
| - layer_tree_host_->UnregisterLayer(child);
|
| + layer_tree->UnregisterLayer(child);
|
| src->clip_children_.reset();
|
| dest->clip_children_.reset();
|
| }
|
| @@ -1411,7 +1418,8 @@ TEST_F(LayerTest, DeleteRemovedScrollParent) {
|
| EXPECT_SET_NEEDS_COMMIT(1, child2 = nullptr);
|
|
|
| EXPECT_TRUE(
|
| - layer_tree_host_->LayerNeedsPushPropertiesForTesting(child1.get()));
|
| + layer_tree_host_->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
|
| + child1.get()));
|
|
|
| EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr));
|
| }
|
| @@ -1441,7 +1449,8 @@ TEST_F(LayerTest, DeleteRemovedScrollChild) {
|
| EXPECT_SET_NEEDS_COMMIT(1, child1 = nullptr);
|
|
|
| EXPECT_TRUE(
|
| - layer_tree_host_->LayerNeedsPushPropertiesForTesting(child2.get()));
|
| + layer_tree_host_->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
|
| + child2.get()));
|
|
|
| EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr));
|
| }
|
|
|