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

Unified Diff: ui/views/controls/native/native_view_host_unittest.cc

Issue 317823002: Implement NativeViewHostAura::InstallClip. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
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 247782437a5022d0d45cc68ee4277789ca2b69b1..233ac7ae0382c7675400c0d207460eb2730bcc34 100644
--- a/ui/views/controls/native/native_view_host_unittest.cc
+++ b/ui/views/controls/native/native_view_host_unittest.cc
@@ -135,13 +135,25 @@ TEST_F(NativeViewHostTest, NativeViewHierarchyChanged) {
test_view,
host));
+#if defined(USE_AURA)
+ // One notification is generated from inserting the clipping window into the
sky 2014/06/05 15:49:01 I think we can avoid this if you don't call Widget
calamity 2014/06/06 08:13:45 I made this change and it only works for some of t
+ // 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();
@@ -150,8 +162,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

Powered by Google App Engine
This is Rietveld 408576698