Chromium Code Reviews| Index: ui/views/controls/native/native_view_host_unittest.cc |
| diff --git a/ui/views/controls/native/native_view_host_unittest.cc b/ui/views/controls/native/native_view_host_unittest.cc |
| index f30980bca8bad31eb9c4e2b9a46d89f7ae317892..30a8eb795cf8722dfe8eb78d4901c999ac08a1bb 100644 |
| --- a/ui/views/controls/native/native_view_host_unittest.cc |
| +++ b/ui/views/controls/native/native_view_host_unittest.cc |
| @@ -9,6 +9,7 @@ |
| #endif |
| #include "base/basictypes.h" |
| +#include "base/debug/stack_trace.h" |
|
xiyuan
2013/10/10 18:00:26
nit: seems not used
rharrison
2013/10/10 18:04:36
Done.
|
| #include "base/memory/scoped_ptr.h" |
| #include "ui/views/test/views_test_base.h" |
| #include "ui/views/widget/widget.h" |
| @@ -148,13 +149,25 @@ TEST_F(NativeViewHostTest, NativeViewHierarchyChanged) { |
| test_view, |
| host)); |
| +#if defined(USE_AURA) |
| + // One notification is generated from inserting the clipping window into the |
| + // hierarchy. |
| + EXPECT_EQ(1, test_view->notification_count()); |
| +#else |
| EXPECT_EQ(0, test_view->notification_count()); |
| +#endif |
| test_view->ResetCount(); |
| // Detaching should send a NativeViewHierarchyChanged() notification and |
| // change the parent. |
| host->Detach(); |
| +#if defined(USE_AURA) |
| + // The clipping window is removed on detach, so there is an extra hiearchy |
| + // change. |
| + EXPECT_EQ(2, test_view->notification_count()); |
| +#else |
| EXPECT_EQ(1, test_view->notification_count()); |
| +#endif |
| EXPECT_NE(toplevel()->GetNativeView(), |
| GetNativeParent(child->GetNativeView())); |
| test_view->ResetCount(); |
| @@ -163,8 +176,15 @@ TEST_F(NativeViewHostTest, NativeViewHierarchyChanged) { |
| // reset the parent. |
| host->Attach(child->GetNativeView()); |
| EXPECT_EQ(1, test_view->notification_count()); |
| +#if defined(USE_AURA) |
| + // There is a clipping window inserted above the native view that needs to be |
| + // accounted for when looking at the relationship between the native views.. |
| + EXPECT_EQ(toplevel()->GetNativeView(), |
| + GetNativeParent(GetNativeParent(child->GetNativeView()))); |
| +#else |
| EXPECT_EQ(toplevel()->GetNativeView(), |
| GetNativeParent(child->GetNativeView())); |
| +#endif |
| } |
| // Verifies ViewHierarchyChanged handles NativeViewHost remove, add and move |