Chromium Code Reviews| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/session/session_state_delegate.h" | 10 #include "ash/session/session_state_delegate.h" |
| 11 #include "ash/shelf/shelf_layout_manager.h" | 11 #include "ash/shelf/shelf.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/shell_window_ids.h" | 13 #include "ash/shell_window_ids.h" |
| 14 #include "ash/system/tray/system_tray_delegate.h" | 14 #include "ash/system/tray/system_tray_delegate.h" |
| 15 #include "ash/test/ash_test_base.h" | 15 #include "ash/test/ash_test_base.h" |
| 16 #include "ash/test/display_manager_test_api.h" | 16 #include "ash/test/display_manager_test_api.h" |
| 17 #include "ash/wm/common/window_state.h" | 17 #include "ash/wm/common/window_state.h" |
| 18 #include "ash/wm/system_modal_container_layout_manager.h" | 18 #include "ash/wm/system_modal_container_layout_manager.h" |
| 19 #include "ash/wm/window_properties.h" | 19 #include "ash/wm/window_properties.h" |
| 20 #include "ash/wm/window_state_aura.h" | 20 #include "ash/wm/window_state_aura.h" |
| 21 #include "ash/wm/window_util.h" | 21 #include "ash/wm/window_util.h" |
| 22 #include "base/command_line.h" | 22 #include "base/command_line.h" |
| 23 #include "ui/aura/client/focus_change_observer.h" | 23 #include "ui/aura/client/focus_change_observer.h" |
| 24 #include "ui/aura/client/focus_client.h" | 24 #include "ui/aura/client/focus_client.h" |
| 25 #include "ui/aura/client/window_tree_client.h" | 25 #include "ui/aura/client/window_tree_client.h" |
| 26 #include "ui/aura/env.h" | 26 #include "ui/aura/env.h" |
| 27 #include "ui/aura/test/test_window_delegate.h" | 27 #include "ui/aura/test/test_window_delegate.h" |
| 28 #include "ui/aura/test/test_windows.h" | 28 #include "ui/aura/test/test_windows.h" |
| 29 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
| 30 #include "ui/aura/window_event_dispatcher.h" | 30 #include "ui/aura/window_event_dispatcher.h" |
| 31 #include "ui/aura/window_tracker.h" | 31 #include "ui/aura/window_tracker.h" |
| 32 #include "ui/base/ime/dummy_text_input_client.h" | 32 #include "ui/base/ime/dummy_text_input_client.h" |
| 33 #include "ui/base/ime/input_method.h" | 33 #include "ui/base/ime/input_method.h" |
| 34 #include "ui/base/ime/text_input_client.h" | 34 #include "ui/base/ime/text_input_client.h" |
| 35 #include "ui/events/test/event_generator.h" | 35 #include "ui/events/test/event_generator.h" |
| 36 #include "ui/events/test/test_event_handler.h" | 36 #include "ui/events/test/test_event_handler.h" |
| 37 #include "ui/keyboard/keyboard_controller.h" | |
| 37 #include "ui/keyboard/keyboard_switches.h" | 38 #include "ui/keyboard/keyboard_switches.h" |
| 38 #include "ui/keyboard/keyboard_ui.h" | 39 #include "ui/keyboard/keyboard_ui.h" |
| 39 #include "ui/keyboard/keyboard_util.h" | 40 #include "ui/keyboard/keyboard_util.h" |
| 40 #include "ui/views/controls/menu/menu_controller.h" | 41 #include "ui/views/controls/menu/menu_controller.h" |
| 41 #include "ui/views/widget/widget.h" | 42 #include "ui/views/widget/widget.h" |
| 42 #include "ui/views/widget/widget_delegate.h" | 43 #include "ui/views/widget/widget_delegate.h" |
| 43 | 44 |
| 44 using aura::Window; | 45 using aura::Window; |
| 45 using views::Widget; | 46 using views::Widget; |
| 46 | 47 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 ash::kShellWindowId_SystemModalContainer); | 128 ash::kShellWindowId_SystemModalContainer); |
| 128 } | 129 } |
| 129 }; | 130 }; |
| 130 | 131 |
| 131 TEST_F(RootWindowControllerTest, MoveWindows_Basic) { | 132 TEST_F(RootWindowControllerTest, MoveWindows_Basic) { |
| 132 if (!SupportsMultipleDisplays()) | 133 if (!SupportsMultipleDisplays()) |
| 133 return; | 134 return; |
| 134 // Windows origin should be doubled when moved to the 1st display. | 135 // Windows origin should be doubled when moved to the 1st display. |
| 135 UpdateDisplay("600x600,300x300"); | 136 UpdateDisplay("600x600,300x300"); |
| 136 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 137 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 137 RootWindowController* controller = Shell::GetPrimaryRootWindowController(); | 138 Shelf* shelf = Shelf::ForPrimaryDisplay(); |
| 138 ShelfLayoutManager* shelf_layout_manager = | 139 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
|
msw
2016/06/01 00:53:23
q: is this even necessary for the test?
James Cook
2016/06/01 15:53:06
Removed and adjusted the expected bounds below. I
| |
| 139 controller->GetShelfLayoutManager(); | |
| 140 shelf_layout_manager->SetAutoHideBehavior( | |
| 141 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | |
| 142 | 140 |
| 143 views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100)); | 141 views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100)); |
| 144 EXPECT_EQ(root_windows[1], normal->GetNativeView()->GetRootWindow()); | 142 EXPECT_EQ(root_windows[1], normal->GetNativeView()->GetRootWindow()); |
| 145 EXPECT_EQ("650,10 100x100", normal->GetWindowBoundsInScreen().ToString()); | 143 EXPECT_EQ("650,10 100x100", normal->GetWindowBoundsInScreen().ToString()); |
| 146 EXPECT_EQ("50,10 100x100", | 144 EXPECT_EQ("50,10 100x100", |
| 147 normal->GetNativeView()->GetBoundsInRootWindow().ToString()); | 145 normal->GetNativeView()->GetBoundsInRootWindow().ToString()); |
| 148 | 146 |
| 149 views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); | 147 views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); |
| 150 maximized->Maximize(); | 148 maximized->Maximize(); |
| 151 EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); | 149 EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1049 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( | 1047 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( |
| 1050 gfx::Rect(0, 400, 800, 200)); | 1048 gfx::Rect(0, 400, 800, 200)); |
| 1051 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); | 1049 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); |
| 1052 | 1050 |
| 1053 UpdateDisplay("600x800"); | 1051 UpdateDisplay("600x800"); |
| 1054 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); | 1052 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); |
| 1055 } | 1053 } |
| 1056 | 1054 |
| 1057 } // namespace test | 1055 } // namespace test |
| 1058 } // namespace ash | 1056 } // namespace ash |
| OLD | NEW |