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

Unified Diff: cc/layers/layer_unittest.cc

Issue 572483002: Fix RemoveFromScrollTree and RemoveFromClipTree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/trees/tree_synchronizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_unittest.cc
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc
index 7a1cb796363805e0870cbf0a7befec93625cfa0f..bab6d5c623da19ac45c2e2a05f4a2e28ff1f0563 100644
--- a/cc/layers/layer_unittest.cc
+++ b/cc/layers/layer_unittest.cc
@@ -336,6 +336,64 @@ TEST_F(LayerTest, ReplaceChildWithNewChildThatHasOtherParent) {
EXPECT_FALSE(child2_->parent());
}
+TEST_F(LayerTest, DeleteRemovedScrollParent) {
+ scoped_refptr<Layer> parent = Layer::Create();
+ scoped_refptr<Layer> child1 = Layer::Create();
+ scoped_refptr<Layer> child2 = Layer::Create();
+
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent));
+
+ ASSERT_EQ(0U, parent->children().size());
+
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, parent->InsertChild(child1, 0));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, parent->InsertChild(child2, 1));
+
+ ASSERT_EQ(2U, parent->children().size());
+ EXPECT_EQ(child1, parent->children()[0]);
+ EXPECT_EQ(child2, parent->children()[1]);
+
+ EXPECT_SET_NEEDS_COMMIT(2, child1->SetScrollParent(child2.get()));
+
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, child2->RemoveFromParent());
+
+ child1->reset_needs_push_properties_for_testing();
+
+ EXPECT_SET_NEEDS_COMMIT(1, child2 = NULL);
+
+ EXPECT_TRUE(child1->needs_push_properties());
+
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(NULL));
+}
+
+TEST_F(LayerTest, DeleteRemovedScrollChild) {
+ scoped_refptr<Layer> parent = Layer::Create();
+ scoped_refptr<Layer> child1 = Layer::Create();
+ scoped_refptr<Layer> child2 = Layer::Create();
+
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent));
+
+ ASSERT_EQ(0U, parent->children().size());
+
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, parent->InsertChild(child1, 0));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, parent->InsertChild(child2, 1));
+
+ ASSERT_EQ(2U, parent->children().size());
+ EXPECT_EQ(child1, parent->children()[0]);
+ EXPECT_EQ(child2, parent->children()[1]);
+
+ EXPECT_SET_NEEDS_COMMIT(2, child1->SetScrollParent(child2.get()));
+
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, child1->RemoveFromParent());
+
+ child2->reset_needs_push_properties_for_testing();
+
+ EXPECT_SET_NEEDS_COMMIT(1, child1 = NULL);
+
+ EXPECT_TRUE(child2->needs_push_properties());
+
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(NULL));
+}
+
TEST_F(LayerTest, ReplaceChildWithSameChild) {
CreateSimpleTestTree();
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/trees/tree_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698