| 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/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.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_util.h" | 14 #include "ash/wm/window_util.h" |
| 15 #include "ui/aura/client/focus_client.h" |
| 15 #include "ui/aura/env.h" | 16 #include "ui/aura/env.h" |
| 16 #include "ui/aura/focus_manager.h" | |
| 17 #include "ui/aura/root_window.h" | 17 #include "ui/aura/root_window.h" |
| 18 #include "ui/aura/test/event_generator.h" | 18 #include "ui/aura/test/event_generator.h" |
| 19 #include "ui/aura/test/test_window_delegate.h" | 19 #include "ui/aura/test/test_window_delegate.h" |
| 20 #include "ui/aura/test/test_windows.h" | 20 #include "ui/aura/test/test_windows.h" |
| 21 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
| 22 #include "ui/aura/window_tracker.h" | 22 #include "ui/aura/window_tracker.h" |
| 23 #include "ui/views/controls/menu/menu_controller.h" | 23 #include "ui/views/controls/menu/menu_controller.h" |
| 24 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
| 25 #include "ui/views/widget/widget_delegate.h" | 25 #include "ui/views/widget/widget_delegate.h" |
| 26 | 26 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); | 143 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); |
| 144 #endif | 144 #endif |
| 145 | 145 |
| 146 // Make sure a window that will delete itself when losing focus | 146 // Make sure a window that will delete itself when losing focus |
| 147 // will not crash. | 147 // will not crash. |
| 148 aura::WindowTracker tracker; | 148 aura::WindowTracker tracker; |
| 149 DeleteOnBlurDelegate delete_on_blur_delegate; | 149 DeleteOnBlurDelegate delete_on_blur_delegate; |
| 150 aura::Window* d2 = aura::test::CreateTestWindowWithDelegate( | 150 aura::Window* d2 = aura::test::CreateTestWindowWithDelegate( |
| 151 &delete_on_blur_delegate, 0, gfx::Rect(50, 50, 100, 100), NULL); | 151 &delete_on_blur_delegate, 0, gfx::Rect(50, 50, 100, 100), NULL); |
| 152 delete_on_blur_delegate.set_window(d2); | 152 delete_on_blur_delegate.set_window(d2); |
| 153 root_windows[0]->GetFocusManager()->SetFocusedWindow( | 153 aura::client::GetFocusClient(root_windows[0])->FocusWindow(d2, NULL); |
| 154 d2, NULL); | |
| 155 tracker.Add(d2); | 154 tracker.Add(d2); |
| 156 | 155 |
| 157 UpdateDisplay("600x600"); | 156 UpdateDisplay("600x600"); |
| 158 | 157 |
| 159 // d2 must have been deleted. | 158 // d2 must have been deleted. |
| 160 EXPECT_FALSE(tracker.Contains(d2)); | 159 EXPECT_FALSE(tracker.Contains(d2)); |
| 161 | 160 |
| 162 EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); | 161 EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); |
| 163 EXPECT_EQ("50,10 100x100", normal->GetWindowBoundsInScreen().ToString()); | 162 EXPECT_EQ("50,10 100x100", normal->GetWindowBoundsInScreen().ToString()); |
| 164 EXPECT_EQ("50,10 100x100", | 163 EXPECT_EQ("50,10 100x100", |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 views::Widget* session_modal_widget = | 308 views::Widget* session_modal_widget = |
| 310 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); | 309 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); |
| 311 EXPECT_EQ(Shell::GetContainer(controller->root_window(), | 310 EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 312 internal::kShellWindowId_SystemModalContainer)->layout_manager(), | 311 internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
| 313 controller->GetSystemModalLayoutManager( | 312 controller->GetSystemModalLayoutManager( |
| 314 session_modal_widget->GetNativeView())); | 313 session_modal_widget->GetNativeView())); |
| 315 } | 314 } |
| 316 | 315 |
| 317 } // namespace test | 316 } // namespace test |
| 318 } // namespace ash | 317 } // namespace ash |
| OLD | NEW |