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

Unified Diff: cc/layer_unittest.cc

Issue 11377108: [cc] Fix crash when adding a child layer to its own parent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 8 years, 1 month 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/layer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_unittest.cc
diff --git a/cc/layer_unittest.cc b/cc/layer_unittest.cc
index 2bbbef4db906dea6fde27092e775716adcde02b4..92b150efa5cfc009f0032d0ec606e350a45cdf0f 100644
--- a/cc/layer_unittest.cc
+++ b/cc/layer_unittest.cc
@@ -164,6 +164,24 @@ TEST_F(LayerTest, addAndRemoveChild)
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(AtLeast(1), child->removeFromParent());
}
+TEST_F(LayerTest, addSameChildTwice)
+{
+ scoped_refptr<Layer> parent = Layer::create();
+ scoped_refptr<Layer> child = Layer::create();
+
+ m_layerTreeHost->setRootLayer(parent);
+
+ ASSERT_EQ(0u, parent->children().size());
+
+ parent->addChild(child);
+ ASSERT_EQ(1u, parent->children().size());
+ EXPECT_EQ(parent.get(), child->parent());
+
+ parent->addChild(child);
+ ASSERT_EQ(1u, parent->children().size());
+ EXPECT_EQ(parent.get(), child->parent());
+}
+
TEST_F(LayerTest, insertChild)
{
scoped_refptr<Layer> parent = Layer::create();
« no previous file with comments | « cc/layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698