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

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: Changes as requested 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..7653cc905c31ba106fc6e6d4b920b754f9a4289b 100644
--- a/ui/views/controls/native/native_view_host_aura_unittest.cc
+++ b/ui/views/controls/native/native_view_host_aura_unittest.cc
@@ -10,6 +10,7 @@
#include "ui/views/controls/native/native_view_host.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/view.h"
+#include "ui/views/view_constants_aura.h"
#include "ui/views/widget/widget.h"
namespace views {
@@ -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(views::kHostViewKey));
+
+ host()->Detach();
+ EXPECT_FALSE(child_win->GetProperty(views::kHostViewKey));
+
+ host()->Attach(child_win);
+ EXPECT_EQ(host(), child_win->GetProperty(views::kHostViewKey));
+
+ DestroyHost();
+ EXPECT_FALSE(child_win->GetProperty(views::kHostViewKey));
+}
+
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698