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

Unified Diff: ui/aura/window_unittest.cc

Issue 8700013: Release aura::Desktop event handler windows on detaching an ancestor window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use parent_ to access parent. Created 9 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 | « ui/aura/window.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window_unittest.cc
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
index 9d5f368b2ccdacb556e7c9bd8d3f8491a9c7f8b1..ea112f0597393181d3a618e3f859cb2cc8520235 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -137,6 +137,28 @@ TEST_F(WindowTest, GetChildById) {
EXPECT_EQ(w111.get(), w1->GetChildById(111));
}
+// Make sure that Window::Contains correctly handles children, grandchildren,
+// and not containing NULL or parents.
+TEST_F(WindowTest, Contains) {
+ Window parent(NULL);
+ parent.Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
+ Window child1(NULL);
+ child1.Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
+ Window child2(NULL);
+ child2.Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
+
+ child1.SetParent(&parent);
+ child2.SetParent(&child1);
+
+ EXPECT_TRUE(parent.Contains(&parent));
+ EXPECT_TRUE(parent.Contains(&child1));
+ EXPECT_TRUE(parent.Contains(&child2));
+
+ EXPECT_FALSE(parent.Contains(NULL));
+ EXPECT_FALSE(child1.Contains(&parent));
+ EXPECT_FALSE(child2.Contains(&child1));
+}
+
TEST_F(WindowTest, ConvertPointToWindow) {
// Window::ConvertPointToWindow is mostly identical to
// Layer::ConvertPointToLayer, except NULL values for |source| are permitted,
« no previous file with comments | « ui/aura/window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698