OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/controls/native/native_view_host_aura.h" | 5 #include "ui/views/controls/native/native_view_host_aura.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 clipping_window()->bounds().ToString()); | 250 clipping_window()->bounds().ToString()); |
251 | 251 |
252 DestroyHost(); | 252 DestroyHost(); |
253 } | 253 } |
254 | 254 |
255 // Ensure native view is parented to the root window after detaching. This is | 255 // Ensure native view is parented to the root window after detaching. This is |
256 // a regression test for http://crbug.com/389261. | 256 // a regression test for http://crbug.com/389261. |
257 TEST_F(NativeViewHostAuraTest, ParentAfterDetach) { | 257 TEST_F(NativeViewHostAuraTest, ParentAfterDetach) { |
258 CreateHost(); | 258 CreateHost(); |
259 aura::Window* child_win = child()->GetNativeView(); | 259 aura::Window* child_win = child()->GetNativeView(); |
260 aura::Window* root_window = child_win->GetRootWindow(); | |
261 aura::WindowTreeHost* child_win_tree_host = child_win->GetHost(); | |
262 | 260 |
263 NativeViewHostWindowObserver test_observer; | 261 NativeViewHostWindowObserver test_observer; |
264 child_win->AddObserver(&test_observer); | 262 child_win->AddObserver(&test_observer); |
265 | 263 |
266 host()->Detach(); | 264 host()->Detach(); |
267 EXPECT_EQ(root_window, child_win->GetRootWindow()); | 265 EXPECT_EQ(nullptr, child_win->GetRootWindow()); |
268 EXPECT_EQ(child_win_tree_host, child_win->GetHost()); | 266 EXPECT_EQ(nullptr, child_win->GetHost()); |
269 | 267 |
270 DestroyHost(); | 268 DestroyHost(); |
271 | 269 |
272 // The window is detached, so no longer associated with any Widget hierarchy. | 270 // The window is detached, so no longer associated with any Widget hierarchy. |
273 // The root window still owns it, but the test harness checks for orphaned | 271 // The root window still owns it, but the test harness checks for orphaned |
274 // windows during TearDown(). | 272 // windows during TearDown(). |
275 DestroyTopLevel(); | 273 DestroyTopLevel(); |
276 EXPECT_EQ(0u, test_observer.events().size()); | 274 EXPECT_EQ(0u, test_observer.events().size()); |
277 delete child_win; | 275 delete child_win; |
278 ASSERT_EQ(1u, test_observer.events().size()); | 276 ASSERT_EQ(1u, test_observer.events().size()); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 361 |
364 host()->SetVisible(false); | 362 host()->SetVisible(false); |
365 EXPECT_FALSE(clipping_window()->IsVisible()); | 363 EXPECT_FALSE(clipping_window()->IsVisible()); |
366 EXPECT_FALSE(child()->IsVisible()); | 364 EXPECT_FALSE(child()->IsVisible()); |
367 | 365 |
368 DestroyHost(); | 366 DestroyHost(); |
369 DestroyTopLevel(); | 367 DestroyTopLevel(); |
370 } | 368 } |
371 | 369 |
372 } // namespace views | 370 } // namespace views |
OLD | NEW |