Commit c1db769f authored by tfarina@chromium.org's avatar tfarina@chromium.org

views: Add unittests for View::RemoveAllChildViews() method.

BUG=None
TEST=None

R=sky@chromium.org,pkasting@chromium.org

Review URL: http://codereview.chromium.org/7046074

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88557 0039d316-1c4b-4281-b951-d872f2087c98
parent 27b1d062
......@@ -2002,6 +2002,39 @@ TEST_F(ViewTest, ConvertPointToViewWithTransform) {
}
}
// Verify if the child views added under the root are all deleted when
// calling RemoveAllChildViews.
// The tree looks like this:
// root
// |-- child
// | |-- foo
// | |-- bar0
// | |-- bar1
// +-------|-- bar2
TEST_F(ViewTest, RemoveAllChildViews) {
View root;
View* child = new View();
root.AddChildView(child);
View* foo = new View();
child->AddChildView(foo);
// Add some nodes to |foo|.
for (int i = 0; i < 3; ++i)
foo->AddChildView(new View());
ASSERT_EQ(1, root.child_count());
ASSERT_EQ(1, child->child_count());
ASSERT_EQ(3, foo->child_count());
// Now remove all child views from root.
root.RemoveAllChildViews(true);
ASSERT_EQ(0, root.child_count());
ASSERT_FALSE(root.has_children());
}
TEST_F(ViewTest, Contains) {
View v1;
View* v2 = new View();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment