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

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

Issue 15114002: Reorder the NativeViews attached to a view via kViewHostKey according to the position of the view (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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_aura_unittest.cc
diff --git a/ui/views/controls/native/native_view_host_aura_unittest.cc b/ui/views/controls/native/native_view_host_aura_unittest.cc
index 30999326b66c86481def586954968ed2ade624b7..bd63433b74e0804d63f83b5a5dc57a9b4e84d2e7 100644
--- a/ui/views/controls/native/native_view_host_aura_unittest.cc
+++ b/ui/views/controls/native/native_view_host_aura_unittest.cc
@@ -6,6 +6,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/views/controls/native/native_view_host.h"
#include "ui/views/test/views_test_base.h"
@@ -23,6 +24,10 @@ class NativeViewHostAuraTest : public ViewsTestBase {
return static_cast<NativeViewHostAura*>(host_->native_wrapper_.get());
}
+ NativeViewHost* host() {
+ return host_.get();
+ }
+
Widget* child() {
return child_.get();
}
@@ -73,4 +78,21 @@ TEST_F(NativeViewHostAuraTest, StopObservingNativeViewOnDestruct) {
EXPECT_FALSE(child_win->HasObserver(aura_host));
}
+// Tests that the kHostViewKey is correctly set and cleared.
+TEST_F(NativeViewHostAuraTest, HostViewPropertyKey) {
+ // Create the NativeViewHost and attach a NativeView.
+ CreateHost();
+ aura::Window* child_win = child()->GetNativeView();
+ EXPECT_EQ(host(), child_win->GetProperty(aura::client::kHostViewKey));
+
+ host()->Detach();
+ EXPECT_FALSE(child_win->GetProperty(aura::client::kHostViewKey));
+
+ host()->Attach(child_win);
+ EXPECT_EQ(host(), child_win->GetProperty(aura::client::kHostViewKey));
+
+ DestroyHost();
+ EXPECT_FALSE(child_win->GetProperty(aura::client::kHostViewKey));
+}
+
} // namespace views
« ui/aura/client/aura_constants.cc ('K') | « ui/views/controls/native/native_view_host_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698