| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
| 6 | 6 |
| 7 #include "ash/session_state_delegate.h" | 7 #include "ash/session_state_delegate.h" |
| 8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| 11 #include "ash/system/tray/system_tray_delegate.h" | 11 #include "ash/system/tray/system_tray_delegate.h" |
| 12 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
| 13 #include "ash/wm/system_modal_container_layout_manager.h" | 13 #include "ash/wm/system_modal_container_layout_manager.h" |
| 14 #include "ash/wm/window_properties.h" | 14 #include "ash/wm/window_properties.h" |
| 15 #include "ash/wm/window_state.h" | 15 #include "ash/wm/window_state.h" |
| 16 #include "ash/wm/window_util.h" | 16 #include "ash/wm/window_util.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "ui/aura/client/focus_change_observer.h" | 18 #include "ui/aura/client/focus_change_observer.h" |
| 19 #include "ui/aura/client/focus_client.h" | 19 #include "ui/aura/client/focus_client.h" |
| 20 #include "ui/aura/client/window_tree_client.h" |
| 20 #include "ui/aura/env.h" | 21 #include "ui/aura/env.h" |
| 21 #include "ui/aura/root_window.h" | 22 #include "ui/aura/root_window.h" |
| 22 #include "ui/aura/test/event_generator.h" | 23 #include "ui/aura/test/event_generator.h" |
| 23 #include "ui/aura/test/test_window_delegate.h" | 24 #include "ui/aura/test/test_window_delegate.h" |
| 24 #include "ui/aura/test/test_windows.h" | 25 #include "ui/aura/test/test_windows.h" |
| 25 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
| 26 #include "ui/aura/window_tracker.h" | 27 #include "ui/aura/window_tracker.h" |
| 27 #include "ui/keyboard/keyboard_switches.h" | 28 #include "ui/keyboard/keyboard_switches.h" |
| 28 #include "ui/views/controls/menu/menu_controller.h" | 29 #include "ui/views/controls/menu/menu_controller.h" |
| 29 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 | 567 |
| 567 // Verifies shutdown doesn't delete windows that are not owned by the parent. | 568 // Verifies shutdown doesn't delete windows that are not owned by the parent. |
| 568 TEST_F(RootWindowControllerTest, DontDeleteWindowsNotOwnedByParent) { | 569 TEST_F(RootWindowControllerTest, DontDeleteWindowsNotOwnedByParent) { |
| 569 DestroyedWindowObserver observer1; | 570 DestroyedWindowObserver observer1; |
| 570 aura::test::TestWindowDelegate delegate1; | 571 aura::test::TestWindowDelegate delegate1; |
| 571 aura::Window* window1 = new aura::Window(&delegate1); | 572 aura::Window* window1 = new aura::Window(&delegate1); |
| 572 window1->SetType(aura::client::WINDOW_TYPE_CONTROL); | 573 window1->SetType(aura::client::WINDOW_TYPE_CONTROL); |
| 573 window1->set_owned_by_parent(false); | 574 window1->set_owned_by_parent(false); |
| 574 observer1.SetWindow(window1); | 575 observer1.SetWindow(window1); |
| 575 window1->Init(ui::LAYER_NOT_DRAWN); | 576 window1->Init(ui::LAYER_NOT_DRAWN); |
| 576 window1->SetDefaultParentByRootWindow( | 577 aura::client::ParentWindowWithContext( |
| 577 Shell::GetInstance()->GetPrimaryRootWindow(), gfx::Rect()); | 578 window1, Shell::GetInstance()->GetPrimaryRootWindow(), gfx::Rect()); |
| 578 | 579 |
| 579 DestroyedWindowObserver observer2; | 580 DestroyedWindowObserver observer2; |
| 580 aura::Window* window2 = new aura::Window(NULL); | 581 aura::Window* window2 = new aura::Window(NULL); |
| 581 window2->set_owned_by_parent(false); | 582 window2->set_owned_by_parent(false); |
| 582 observer2.SetWindow(window2); | 583 observer2.SetWindow(window2); |
| 583 window2->Init(ui::LAYER_NOT_DRAWN); | 584 window2->Init(ui::LAYER_NOT_DRAWN); |
| 584 Shell::GetInstance()->GetPrimaryRootWindow()->AddChild(window2); | 585 Shell::GetInstance()->GetPrimaryRootWindow()->AddChild(window2); |
| 585 | 586 |
| 586 Shell::GetInstance()->GetPrimaryRootWindowController()->CloseChildWindows(); | 587 Shell::GetInstance()->GetPrimaryRootWindowController()->CloseChildWindows(); |
| 587 | 588 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 aura::WindowTracker tracker; | 695 aura::WindowTracker tracker; |
| 695 tracker.Add(keyboard_container); | 696 tracker.Add(keyboard_container); |
| 696 // Mock a login state change to reinitialize the keyboard. | 697 // Mock a login state change to reinitialize the keyboard. |
| 697 ash::Shell::GetInstance()->OnLoginStateChanged(user::LOGGED_IN_OWNER); | 698 ash::Shell::GetInstance()->OnLoginStateChanged(user::LOGGED_IN_OWNER); |
| 698 // keyboard_container should no longer be present. | 699 // keyboard_container should no longer be present. |
| 699 EXPECT_FALSE(tracker.Contains(keyboard_container)); | 700 EXPECT_FALSE(tracker.Contains(keyboard_container)); |
| 700 } | 701 } |
| 701 | 702 |
| 702 } // namespace test | 703 } // namespace test |
| 703 } // namespace ash | 704 } // namespace ash |
| OLD | NEW |