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

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

Issue 2094513003: views: Restore to old behaviour of Widget::ReparentNativeView(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fc0bb8cc866628b3d2d4676f1c6c861fa7080964..40b5ce771a621b7ecb8b51d3e6ef7c7b9a5a7861 100644
--- a/ui/views/controls/native/native_view_host_aura_unittest.cc
+++ b/ui/views/controls/native/native_view_host_aura_unittest.cc
@@ -257,22 +257,31 @@ TEST_F(NativeViewHostAuraTest, InstallClip) {
TEST_F(NativeViewHostAuraTest, ParentAfterDetach) {
CreateHost();
aura::Window* child_win = child()->GetNativeView();
+ aura::Window* root_window = child_win->GetRootWindow();
+ aura::WindowTreeHost* child_win_tree_host = child_win->GetHost();
NativeViewHostWindowObserver test_observer;
child_win->AddObserver(&test_observer);
host()->Detach();
- EXPECT_EQ(nullptr, child_win->GetRootWindow());
- EXPECT_EQ(nullptr, child_win->GetHost());
+ EXPECT_EQ(root_window, child_win->GetRootWindow());
+ EXPECT_EQ(child_win_tree_host, child_win->GetHost());
DestroyHost();
-
- // The window is detached, so no longer associated with any Widget hierarchy.
- // The root window still owns it, but the test harness checks for orphaned
- // windows during TearDown().
DestroyTopLevel();
- EXPECT_EQ(0u, test_observer.events().size());
- delete child_win;
+ if (!IsMus()) {
+ // The window is detached, so no longer associated with any Widget
+ // hierarchy. The root window still owns it, but the test harness checks
+ // for orphaned windows during TearDown().
+ EXPECT_EQ(0u, test_observer.events().size())
+ << (*test_observer.events().begin()).type;
+ delete child_win;
+ } else {
+ // In mus, the child window is still attached to the aura::WindowTreeHost
+ // for the Widget. So destroying the toplevel Widget takes down the child
+ // window with it.
+ }
+
ASSERT_EQ(1u, test_observer.events().size());
EXPECT_EQ(NativeViewHostWindowObserver::EVENT_DESTROYED,
test_observer.events().back().type);
« no previous file with comments | « no previous file | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698