| 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" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 params.bounds = gfx::Rect(650, 10, 100, 100); | 170 params.bounds = gfx::Rect(650, 10, 100, 100); |
| 171 params.context = CurrentContext(); | 171 params.context = CurrentContext(); |
| 172 params.type = Widget::InitParams::TYPE_CONTROL; | 172 params.type = Widget::InitParams::TYPE_CONTROL; |
| 173 unparented_control->Init(params); | 173 unparented_control->Init(params); |
| 174 EXPECT_EQ(root_windows[1], | 174 EXPECT_EQ(root_windows[1], |
| 175 unparented_control->GetNativeView()->GetRootWindow()); | 175 unparented_control->GetNativeView()->GetRootWindow()); |
| 176 EXPECT_EQ(internal::kShellWindowId_UnparentedControlContainer, | 176 EXPECT_EQ(internal::kShellWindowId_UnparentedControlContainer, |
| 177 unparented_control->GetNativeView()->parent()->id()); | 177 unparented_control->GetNativeView()->parent()->id()); |
| 178 | 178 |
| 179 aura::Window* panel = CreateTestWindowInShellWithDelegateAndType( | 179 aura::Window* panel = CreateTestWindowInShellWithDelegateAndType( |
| 180 NULL, aura::client::WINDOW_TYPE_PANEL, 0, gfx::Rect(700, 100, 100, 100)); | 180 NULL, ui::wm::WINDOW_TYPE_PANEL, 0, gfx::Rect(700, 100, 100, 100)); |
| 181 EXPECT_EQ(root_windows[1], panel->GetRootWindow()); | 181 EXPECT_EQ(root_windows[1], panel->GetRootWindow()); |
| 182 EXPECT_EQ(internal::kShellWindowId_PanelContainer, panel->parent()->id()); | 182 EXPECT_EQ(internal::kShellWindowId_PanelContainer, panel->parent()->id()); |
| 183 | 183 |
| 184 // Make sure a window that will delete itself when losing focus | 184 // Make sure a window that will delete itself when losing focus |
| 185 // will not crash. | 185 // will not crash. |
| 186 aura::WindowTracker tracker; | 186 aura::WindowTracker tracker; |
| 187 DeleteOnBlurDelegate delete_on_blur_delegate; | 187 DeleteOnBlurDelegate delete_on_blur_delegate; |
| 188 aura::Window* d2 = CreateTestWindowInShellWithDelegate( | 188 aura::Window* d2 = CreateTestWindowInShellWithDelegate( |
| 189 &delete_on_blur_delegate, 0, gfx::Rect(50, 50, 100, 100)); | 189 &delete_on_blur_delegate, 0, gfx::Rect(50, 50, 100, 100)); |
| 190 delete_on_blur_delegate.SetWindow(d2); | 190 delete_on_blur_delegate.SetWindow(d2); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 Window* window_; | 519 Window* window_; |
| 520 | 520 |
| 521 DISALLOW_COPY_AND_ASSIGN(DestroyedWindowObserver); | 521 DISALLOW_COPY_AND_ASSIGN(DestroyedWindowObserver); |
| 522 }; | 522 }; |
| 523 | 523 |
| 524 // Verifies shutdown doesn't delete windows that are not owned by the parent. | 524 // Verifies shutdown doesn't delete windows that are not owned by the parent. |
| 525 TEST_F(RootWindowControllerTest, DontDeleteWindowsNotOwnedByParent) { | 525 TEST_F(RootWindowControllerTest, DontDeleteWindowsNotOwnedByParent) { |
| 526 DestroyedWindowObserver observer1; | 526 DestroyedWindowObserver observer1; |
| 527 aura::test::TestWindowDelegate delegate1; | 527 aura::test::TestWindowDelegate delegate1; |
| 528 aura::Window* window1 = new aura::Window(&delegate1); | 528 aura::Window* window1 = new aura::Window(&delegate1); |
| 529 window1->SetType(aura::client::WINDOW_TYPE_CONTROL); | 529 window1->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
| 530 window1->set_owned_by_parent(false); | 530 window1->set_owned_by_parent(false); |
| 531 observer1.SetWindow(window1); | 531 observer1.SetWindow(window1); |
| 532 window1->Init(ui::LAYER_NOT_DRAWN); | 532 window1->Init(ui::LAYER_NOT_DRAWN); |
| 533 aura::client::ParentWindowWithContext( | 533 aura::client::ParentWindowWithContext( |
| 534 window1, Shell::GetInstance()->GetPrimaryRootWindow(), gfx::Rect()); | 534 window1, Shell::GetInstance()->GetPrimaryRootWindow(), gfx::Rect()); |
| 535 | 535 |
| 536 DestroyedWindowObserver observer2; | 536 DestroyedWindowObserver observer2; |
| 537 aura::Window* window2 = new aura::Window(NULL); | 537 aura::Window* window2 = new aura::Window(NULL); |
| 538 window2->set_owned_by_parent(false); | 538 window2->set_owned_by_parent(false); |
| 539 observer2.SetWindow(window2); | 539 observer2.SetWindow(window2); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 aura::WindowTracker tracker; | 656 aura::WindowTracker tracker; |
| 657 tracker.Add(keyboard_container); | 657 tracker.Add(keyboard_container); |
| 658 // Mock a login user profile change to reinitialize the keyboard. | 658 // Mock a login user profile change to reinitialize the keyboard. |
| 659 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); | 659 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); |
| 660 // keyboard_container should no longer be present. | 660 // keyboard_container should no longer be present. |
| 661 EXPECT_FALSE(tracker.Contains(keyboard_container)); | 661 EXPECT_FALSE(tracker.Contains(keyboard_container)); |
| 662 } | 662 } |
| 663 | 663 |
| 664 } // namespace test | 664 } // namespace test |
| 665 } // namespace ash | 665 } // namespace ash |
| OLD | NEW |