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

Side by Side Diff: ash/wm/lock_layout_manager_unittest.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « ash/wm/lock_layout_manager.cc ('k') | ash/wm/lock_state_controller.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/common/shell_window_ids.h" 5 #include "ash/common/shell_window_ids.h"
6 #include "ash/common/wm/window_state.h" 6 #include "ash/common/wm/window_state.h"
7 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 13 matching lines...) Expand all
24 namespace ash { 24 namespace ash {
25 namespace test { 25 namespace test {
26 26
27 namespace { 27 namespace {
28 28
29 const int kVirtualKeyboardHeight = 100; 29 const int kVirtualKeyboardHeight = 100;
30 30
31 // A login implementation of WidgetDelegate. 31 // A login implementation of WidgetDelegate.
32 class LoginTestWidgetDelegate : public views::WidgetDelegate { 32 class LoginTestWidgetDelegate : public views::WidgetDelegate {
33 public: 33 public:
34 explicit LoginTestWidgetDelegate(views::Widget* widget) : widget_(widget) { 34 explicit LoginTestWidgetDelegate(views::Widget* widget) : widget_(widget) {}
35 }
36 ~LoginTestWidgetDelegate() override {} 35 ~LoginTestWidgetDelegate() override {}
37 36
38 // Overridden from WidgetDelegate: 37 // Overridden from WidgetDelegate:
39 void DeleteDelegate() override { delete this; } 38 void DeleteDelegate() override { delete this; }
40 views::Widget* GetWidget() override { return widget_; } 39 views::Widget* GetWidget() override { return widget_; }
41 const views::Widget* GetWidget() const override { return widget_; } 40 const views::Widget* GetWidget() const override { return widget_; }
42 bool CanActivate() const override { return true; } 41 bool CanActivate() const override { return true; }
43 bool ShouldAdvanceFocusToTopLevelWidget() const override { return true; } 42 bool ShouldAdvanceFocusToTopLevelWidget() const override { return true; }
44 43
45 private: 44 private:
(...skipping 16 matching lines...) Expand all
62 } 61 }
63 62
64 void TearDown() override { 63 void TearDown() override {
65 Shell::GetPrimaryRootWindowController()->DeactivateKeyboard( 64 Shell::GetPrimaryRootWindowController()->DeactivateKeyboard(
66 keyboard::KeyboardController::GetInstance()); 65 keyboard::KeyboardController::GetInstance());
67 AshTestBase::TearDown(); 66 AshTestBase::TearDown();
68 } 67 }
69 68
70 aura::Window* CreateTestLoginWindow(views::Widget::InitParams params, 69 aura::Window* CreateTestLoginWindow(views::Widget::InitParams params,
71 bool use_delegate) { 70 bool use_delegate) {
72 aura::Window* parent = Shell::GetPrimaryRootWindowController()-> 71 aura::Window* parent =
73 GetContainer(ash::kShellWindowId_LockScreenContainer); 72 Shell::GetPrimaryRootWindowController()->GetContainer(
73 ash::kShellWindowId_LockScreenContainer);
74 params.parent = parent; 74 params.parent = parent;
75 views::Widget* widget = new views::Widget; 75 views::Widget* widget = new views::Widget;
76 if (use_delegate) 76 if (use_delegate)
77 params.delegate = new LoginTestWidgetDelegate(widget); 77 params.delegate = new LoginTestWidgetDelegate(widget);
78 widget->Init(params); 78 widget->Init(params);
79 widget->Show(); 79 widget->Show();
80 aura::Window* window = widget->GetNativeView(); 80 aura::Window* window = widget->GetNativeView();
81 return window; 81 return window;
82 } 82 }
83 83
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 194 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
195 widget_params.show_state = ui::SHOW_STATE_FULLSCREEN; 195 widget_params.show_state = ui::SHOW_STATE_FULLSCREEN;
196 std::unique_ptr<aura::Window> window( 196 std::unique_ptr<aura::Window> window(
197 CreateTestLoginWindow(widget_params, false /* use_delegate */)); 197 CreateTestLoginWindow(widget_params, false /* use_delegate */));
198 198
199 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); 199 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString());
200 200
201 // When virtual keyboard overscroll is enabled keyboard bounds should not 201 // When virtual keyboard overscroll is enabled keyboard bounds should not
202 // affect window bounds. 202 // affect window bounds.
203 keyboard::SetKeyboardOverscrollOverride( 203 keyboard::SetKeyboardOverscrollOverride(
204 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_ENABLED); 204 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_ENABLED);
205 ShowKeyboard(true); 205 ShowKeyboard(true);
206 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); 206 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString());
207 gfx::Rect keyboard_bounds = 207 gfx::Rect keyboard_bounds =
208 keyboard::KeyboardController::GetInstance()->current_keyboard_bounds(); 208 keyboard::KeyboardController::GetInstance()->current_keyboard_bounds();
209 EXPECT_NE(keyboard_bounds, gfx::Rect()); 209 EXPECT_NE(keyboard_bounds, gfx::Rect());
210 ShowKeyboard(false); 210 ShowKeyboard(false);
211 211
212 // When keyboard is hidden make sure that rotating the screen gives 100% of 212 // When keyboard is hidden make sure that rotating the screen gives 100% of
213 // screen size to window. 213 // screen size to window.
214 // Repro steps for http://crbug.com/401667: 214 // Repro steps for http://crbug.com/401667:
215 // 1. Set up login screen defaults: VK override disabled 215 // 1. Set up login screen defaults: VK override disabled
216 // 2. Show/hide keyboard, make sure that no stale keyboard bounds are cached. 216 // 2. Show/hide keyboard, make sure that no stale keyboard bounds are cached.
217 keyboard::SetKeyboardOverscrollOverride( 217 keyboard::SetKeyboardOverscrollOverride(
218 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_DISABLED); 218 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_DISABLED);
219 ShowKeyboard(true); 219 ShowKeyboard(true);
220 ShowKeyboard(false); 220 ShowKeyboard(false);
221 ash::DisplayManager* display_manager = 221 ash::DisplayManager* display_manager =
222 Shell::GetInstance()->display_manager(); 222 Shell::GetInstance()->display_manager();
223 display_manager->SetDisplayRotation(primary_display.id(), 223 display_manager->SetDisplayRotation(primary_display.id(),
224 display::Display::ROTATE_90, 224 display::Display::ROTATE_90,
225 display::Display::ROTATION_SOURCE_ACTIVE); 225 display::Display::ROTATION_SOURCE_ACTIVE);
226 primary_display = display::Screen::GetScreen()->GetPrimaryDisplay(); 226 primary_display = display::Screen::GetScreen()->GetPrimaryDisplay();
227 screen_bounds = primary_display.bounds(); 227 screen_bounds = primary_display.bounds();
228 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); 228 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString());
229 display_manager->SetDisplayRotation(primary_display.id(), 229 display_manager->SetDisplayRotation(primary_display.id(),
230 display::Display::ROTATE_0, 230 display::Display::ROTATE_0,
231 display::Display::ROTATION_SOURCE_ACTIVE); 231 display::Display::ROTATION_SOURCE_ACTIVE);
232 232
233 // When virtual keyboard overscroll is disabled keyboard bounds do 233 // When virtual keyboard overscroll is disabled keyboard bounds do
234 // affect window bounds. 234 // affect window bounds.
235 keyboard::SetKeyboardOverscrollOverride( 235 keyboard::SetKeyboardOverscrollOverride(
236 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_DISABLED); 236 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_DISABLED);
237 ShowKeyboard(true); 237 ShowKeyboard(true);
238 keyboard::KeyboardController* keyboard = 238 keyboard::KeyboardController* keyboard =
239 keyboard::KeyboardController::GetInstance(); 239 keyboard::KeyboardController::GetInstance();
240 primary_display = display::Screen::GetScreen()->GetPrimaryDisplay(); 240 primary_display = display::Screen::GetScreen()->GetPrimaryDisplay();
241 screen_bounds = primary_display.bounds(); 241 screen_bounds = primary_display.bounds();
242 gfx::Rect target_bounds(screen_bounds); 242 gfx::Rect target_bounds(screen_bounds);
243 target_bounds.set_height( 243 target_bounds.set_height(
244 target_bounds.height() - 244 target_bounds.height() -
245 keyboard->ui()->GetKeyboardWindow()->bounds().height()); 245 keyboard->ui()->GetKeyboardWindow()->bounds().height());
246 EXPECT_EQ(target_bounds.ToString(), window->GetBoundsInScreen().ToString()); 246 EXPECT_EQ(target_bounds.ToString(), window->GetBoundsInScreen().ToString());
247 ShowKeyboard(false); 247 ShowKeyboard(false);
248 248
249 keyboard::SetKeyboardOverscrollOverride( 249 keyboard::SetKeyboardOverscrollOverride(
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get()); 296 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get());
297 window->SetBounds(work_area); 297 window->SetBounds(work_area);
298 // Usually work_area takes Shelf into account but that doesn't affect 298 // Usually work_area takes Shelf into account but that doesn't affect
299 // LockScreen container windows. 299 // LockScreen container windows.
300 EXPECT_NE(work_area.ToString(), window->GetBoundsInScreen().ToString()); 300 EXPECT_NE(work_area.ToString(), window->GetBoundsInScreen().ToString());
301 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); 301 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString());
302 } 302 }
303 303
304 } // namespace test 304 } // namespace test
305 } // namespace ash 305 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/lock_layout_manager.cc ('k') | ash/wm/lock_state_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698