Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 2017413002: ash: Fix variable names and setters in ShelfLayoutManager and tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shellshelf
Patch Set: review comments 3 Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ash/screen_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/wm/window_state.h" 9 #include "ash/common/wm/window_state.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
11 #include "ash/session/session_state_delegate.h" 11 #include "ash/session/session_state_delegate.h"
12 #include "ash/shelf/shelf_layout_manager.h"
13 #include "ash/shell.h" 12 #include "ash/shell.h"
14 #include "ash/shell_window_ids.h" 13 #include "ash/shell_window_ids.h"
15 #include "ash/system/tray/system_tray_delegate.h" 14 #include "ash/system/tray/system_tray_delegate.h"
16 #include "ash/test/ash_test_base.h" 15 #include "ash/test/ash_test_base.h"
17 #include "ash/test/display_manager_test_api.h" 16 #include "ash/test/display_manager_test_api.h"
18 #include "ash/wm/system_modal_container_layout_manager.h" 17 #include "ash/wm/system_modal_container_layout_manager.h"
19 #include "ash/wm/window_properties.h" 18 #include "ash/wm/window_properties.h"
20 #include "ash/wm/window_state_aura.h" 19 #include "ash/wm/window_state_aura.h"
21 #include "ash/wm/window_util.h" 20 #include "ash/wm/window_util.h"
22 #include "base/command_line.h" 21 #include "base/command_line.h"
23 #include "ui/aura/client/focus_change_observer.h" 22 #include "ui/aura/client/focus_change_observer.h"
24 #include "ui/aura/client/focus_client.h" 23 #include "ui/aura/client/focus_client.h"
25 #include "ui/aura/client/window_tree_client.h" 24 #include "ui/aura/client/window_tree_client.h"
26 #include "ui/aura/env.h" 25 #include "ui/aura/env.h"
27 #include "ui/aura/test/test_window_delegate.h" 26 #include "ui/aura/test/test_window_delegate.h"
28 #include "ui/aura/test/test_windows.h" 27 #include "ui/aura/test/test_windows.h"
29 #include "ui/aura/window.h" 28 #include "ui/aura/window.h"
30 #include "ui/aura/window_event_dispatcher.h" 29 #include "ui/aura/window_event_dispatcher.h"
31 #include "ui/aura/window_tracker.h" 30 #include "ui/aura/window_tracker.h"
32 #include "ui/base/ime/dummy_text_input_client.h" 31 #include "ui/base/ime/dummy_text_input_client.h"
33 #include "ui/base/ime/input_method.h" 32 #include "ui/base/ime/input_method.h"
34 #include "ui/base/ime/text_input_client.h" 33 #include "ui/base/ime/text_input_client.h"
35 #include "ui/events/test/event_generator.h" 34 #include "ui/events/test/event_generator.h"
36 #include "ui/events/test/test_event_handler.h" 35 #include "ui/events/test/test_event_handler.h"
36 #include "ui/keyboard/keyboard_controller.h"
37 #include "ui/keyboard/keyboard_switches.h" 37 #include "ui/keyboard/keyboard_switches.h"
38 #include "ui/keyboard/keyboard_ui.h" 38 #include "ui/keyboard/keyboard_ui.h"
39 #include "ui/keyboard/keyboard_util.h" 39 #include "ui/keyboard/keyboard_util.h"
40 #include "ui/views/controls/menu/menu_controller.h" 40 #include "ui/views/controls/menu/menu_controller.h"
41 #include "ui/views/widget/widget.h" 41 #include "ui/views/widget/widget.h"
42 #include "ui/views/widget/widget_delegate.h" 42 #include "ui/views/widget/widget_delegate.h"
43 43
44 using aura::Window; 44 using aura::Window;
45 using views::Widget; 45 using views::Widget;
46 46
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 ash::kShellWindowId_SystemModalContainer); 127 ash::kShellWindowId_SystemModalContainer);
128 } 128 }
129 }; 129 };
130 130
131 TEST_F(RootWindowControllerTest, MoveWindows_Basic) { 131 TEST_F(RootWindowControllerTest, MoveWindows_Basic) {
132 if (!SupportsMultipleDisplays()) 132 if (!SupportsMultipleDisplays())
133 return; 133 return;
134 // Windows origin should be doubled when moved to the 1st display. 134 // Windows origin should be doubled when moved to the 1st display.
135 UpdateDisplay("600x600,300x300"); 135 UpdateDisplay("600x600,300x300");
136 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 136 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
137 RootWindowController* controller = Shell::GetPrimaryRootWindowController();
138 ShelfLayoutManager* shelf_layout_manager =
139 controller->GetShelfLayoutManager();
140 shelf_layout_manager->SetAutoHideBehavior(
141 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
142 137
143 views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100)); 138 views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100));
144 EXPECT_EQ(root_windows[1], normal->GetNativeView()->GetRootWindow()); 139 EXPECT_EQ(root_windows[1], normal->GetNativeView()->GetRootWindow());
145 EXPECT_EQ("650,10 100x100", normal->GetWindowBoundsInScreen().ToString()); 140 EXPECT_EQ("650,10 100x100", normal->GetWindowBoundsInScreen().ToString());
146 EXPECT_EQ("50,10 100x100", 141 EXPECT_EQ("50,10 100x100",
147 normal->GetNativeView()->GetBoundsInRootWindow().ToString()); 142 normal->GetNativeView()->GetBoundsInRootWindow().ToString());
148 143
149 views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); 144 views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100));
150 maximized->Maximize(); 145 maximized->Maximize();
151 EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); 146 EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow());
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 UpdateDisplay("600x600"); 192 UpdateDisplay("600x600");
198 193
199 // d2 must have been deleted. 194 // d2 must have been deleted.
200 EXPECT_FALSE(tracker.Contains(d2)); 195 EXPECT_FALSE(tracker.Contains(d2));
201 196
202 EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); 197 EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow());
203 EXPECT_EQ("100,20 100x100", normal->GetWindowBoundsInScreen().ToString()); 198 EXPECT_EQ("100,20 100x100", normal->GetWindowBoundsInScreen().ToString());
204 EXPECT_EQ("100,20 100x100", 199 EXPECT_EQ("100,20 100x100",
205 normal->GetNativeView()->GetBoundsInRootWindow().ToString()); 200 normal->GetNativeView()->GetBoundsInRootWindow().ToString());
206 201
207 // Maximized area on primary display has 3px (given as 202 // Maximized area on primary display has 47px (ash::kShelfSize) inset at the
208 // kAutoHideSize in shelf_layout_manager.cc) inset at the bottom. 203 // bottom.
209 204
210 // First clear fullscreen status, since both fullscreen and maximized windows 205 // First clear fullscreen status, since both fullscreen and maximized windows
211 // share the same desktop workspace, which cancels the shelf status. 206 // share the same desktop workspace, which cancels the shelf status.
212 fullscreen->SetFullscreen(false); 207 fullscreen->SetFullscreen(false);
213 EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); 208 EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow());
214 EXPECT_EQ("0,0 600x597", 209 EXPECT_EQ("0,0 600x553", maximized->GetWindowBoundsInScreen().ToString());
215 maximized->GetWindowBoundsInScreen().ToString()); 210 EXPECT_EQ("0,0 600x553",
216 EXPECT_EQ("0,0 600x597",
217 maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); 211 maximized->GetNativeView()->GetBoundsInRootWindow().ToString());
218 212
219 // Set fullscreen to true, but maximized window's size won't change because 213 // Set fullscreen to true, but maximized window's size won't change because
220 // it's not visible. see crbug.com/504299. 214 // it's not visible. see crbug.com/504299.
221 fullscreen->SetFullscreen(true); 215 fullscreen->SetFullscreen(true);
222 EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); 216 EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow());
223 EXPECT_EQ("0,0 600x597", maximized->GetWindowBoundsInScreen().ToString()); 217 EXPECT_EQ("0,0 600x553", maximized->GetWindowBoundsInScreen().ToString());
224 EXPECT_EQ("0,0 600x597", 218 EXPECT_EQ("0,0 600x553",
225 maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); 219 maximized->GetNativeView()->GetBoundsInRootWindow().ToString());
226 220
227 EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow()); 221 EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow());
228 EXPECT_EQ("400,20 100x100", 222 EXPECT_EQ("400,20 100x100",
229 minimized->GetWindowBoundsInScreen().ToString()); 223 minimized->GetWindowBoundsInScreen().ToString());
230 224
231 EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow()); 225 EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow());
232 EXPECT_TRUE(fullscreen->IsFullscreen()); 226 EXPECT_TRUE(fullscreen->IsFullscreen());
233 EXPECT_EQ("0,0 600x600", 227 EXPECT_EQ("0,0 600x600",
234 fullscreen->GetWindowBoundsInScreen().ToString()); 228 fullscreen->GetWindowBoundsInScreen().ToString());
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( 1043 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds(
1050 gfx::Rect(0, 400, 800, 200)); 1044 gfx::Rect(0, 400, 800, 200));
1051 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); 1045 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString());
1052 1046
1053 UpdateDisplay("600x800"); 1047 UpdateDisplay("600x800");
1054 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); 1048 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString());
1055 } 1049 }
1056 1050
1057 } // namespace test 1051 } // namespace test
1058 } // namespace ash 1052 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/screen_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698