| OLD | NEW |
| 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/display/display_manager.h" | 5 #include "ash/display/display_manager.h" |
| 6 #include "ash/root_window_controller.h" | 6 #include "ash/root_window_controller.h" |
| 7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 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 } | 35 } |
| 36 virtual ~LoginTestWidgetDelegate() {} | 36 ~LoginTestWidgetDelegate() override {} |
| 37 | 37 |
| 38 // Overridden from WidgetDelegate: | 38 // Overridden from WidgetDelegate: |
| 39 virtual void DeleteDelegate() override { | 39 void DeleteDelegate() override { delete this; } |
| 40 delete this; | 40 views::Widget* GetWidget() override { return widget_; } |
| 41 } | 41 const views::Widget* GetWidget() const override { return widget_; } |
| 42 virtual views::Widget* GetWidget() override { | 42 bool CanActivate() const override { return true; } |
| 43 return widget_; | 43 bool ShouldAdvanceFocusToTopLevelWidget() const override { return true; } |
| 44 } | |
| 45 virtual const views::Widget* GetWidget() const override { | |
| 46 return widget_; | |
| 47 } | |
| 48 virtual bool CanActivate() const override { | |
| 49 return true; | |
| 50 } | |
| 51 virtual bool ShouldAdvanceFocusToTopLevelWidget() const override { | |
| 52 return true; | |
| 53 } | |
| 54 | 44 |
| 55 private: | 45 private: |
| 56 views::Widget* widget_; | 46 views::Widget* widget_; |
| 57 | 47 |
| 58 DISALLOW_COPY_AND_ASSIGN(LoginTestWidgetDelegate); | 48 DISALLOW_COPY_AND_ASSIGN(LoginTestWidgetDelegate); |
| 59 }; | 49 }; |
| 60 | 50 |
| 61 } // namespace | 51 } // namespace |
| 62 | 52 |
| 63 class LockLayoutManagerTest : public AshTestBase { | 53 class LockLayoutManagerTest : public AshTestBase { |
| 64 public: | 54 public: |
| 65 virtual void SetUp() override { | 55 void SetUp() override { |
| 66 // Allow a virtual keyboard (and initialize it per default). | 56 // Allow a virtual keyboard (and initialize it per default). |
| 67 CommandLine::ForCurrentProcess()->AppendSwitch( | 57 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 68 keyboard::switches::kEnableVirtualKeyboard); | 58 keyboard::switches::kEnableVirtualKeyboard); |
| 69 AshTestBase::SetUp(); | 59 AshTestBase::SetUp(); |
| 70 Shell::GetPrimaryRootWindowController()->ActivateKeyboard( | 60 Shell::GetPrimaryRootWindowController()->ActivateKeyboard( |
| 71 keyboard::KeyboardController::GetInstance()); | 61 keyboard::KeyboardController::GetInstance()); |
| 72 } | 62 } |
| 73 | 63 |
| 74 virtual void TearDown() override { | 64 void TearDown() override { |
| 75 Shell::GetPrimaryRootWindowController()->DeactivateKeyboard( | 65 Shell::GetPrimaryRootWindowController()->DeactivateKeyboard( |
| 76 keyboard::KeyboardController::GetInstance()); | 66 keyboard::KeyboardController::GetInstance()); |
| 77 AshTestBase::TearDown(); | 67 AshTestBase::TearDown(); |
| 78 } | 68 } |
| 79 | 69 |
| 80 aura::Window* CreateTestLoginWindow(views::Widget::InitParams params, | 70 aura::Window* CreateTestLoginWindow(views::Widget::InitParams params, |
| 81 bool use_delegate) { | 71 bool use_delegate) { |
| 82 aura::Window* parent = Shell::GetPrimaryRootWindowController()-> | 72 aura::Window* parent = Shell::GetPrimaryRootWindowController()-> |
| 83 GetContainer(ash::kShellWindowId_LockScreenContainer); | 73 GetContainer(ash::kShellWindowId_LockScreenContainer); |
| 84 params.parent = parent; | 74 params.parent = parent; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get()); | 283 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get()); |
| 294 window->SetBounds(work_area); | 284 window->SetBounds(work_area); |
| 295 // Usually work_area takes Shelf into account but that doesn't affect | 285 // Usually work_area takes Shelf into account but that doesn't affect |
| 296 // LockScreen container windows. | 286 // LockScreen container windows. |
| 297 EXPECT_NE(work_area.ToString(), window->GetBoundsInScreen().ToString()); | 287 EXPECT_NE(work_area.ToString(), window->GetBoundsInScreen().ToString()); |
| 298 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 288 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
| 299 } | 289 } |
| 300 | 290 |
| 301 } // namespace test | 291 } // namespace test |
| 302 } // namespace ash | 292 } // namespace ash |
| OLD | NEW |