| 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/wm/always_on_top_controller.h" | 5 #include "ash/wm/always_on_top_controller.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.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" |
| 11 #include "ash/wm/workspace/workspace_layout_manager.h" | 11 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "ui/keyboard/keyboard_controller.h" | 13 #include "ui/keyboard/keyboard_controller.h" |
| 14 #include "ui/keyboard/keyboard_controller_proxy.h" | |
| 15 #include "ui/keyboard/keyboard_switches.h" | 14 #include "ui/keyboard/keyboard_switches.h" |
| 15 #include "ui/keyboard/keyboard_ui.h" |
| 16 #include "ui/keyboard/keyboard_util.h" | 16 #include "ui/keyboard/keyboard_util.h" |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 namespace test { | 19 namespace test { |
| 20 | 20 |
| 21 class VirtualKeyboardAlwaysOnTopControllerTest : public AshTestBase { | 21 class VirtualKeyboardAlwaysOnTopControllerTest : public AshTestBase { |
| 22 public: | 22 public: |
| 23 VirtualKeyboardAlwaysOnTopControllerTest() {} | 23 VirtualKeyboardAlwaysOnTopControllerTest() {} |
| 24 ~VirtualKeyboardAlwaysOnTopControllerTest() override {} | 24 ~VirtualKeyboardAlwaysOnTopControllerTest() override {} |
| 25 | 25 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 controller->always_on_top_controller(); | 67 controller->always_on_top_controller(); |
| 68 always_on_top_controller->SetLayoutManagerForTest(manager); | 68 always_on_top_controller->SetLayoutManagerForTest(manager); |
| 69 // Activate keyboard. This triggers keyboard listeners to be registered. | 69 // Activate keyboard. This triggers keyboard listeners to be registered. |
| 70 controller->ActivateKeyboard(keyboard_controller); | 70 controller->ActivateKeyboard(keyboard_controller); |
| 71 | 71 |
| 72 // Mock a keyboard appearing. | 72 // Mock a keyboard appearing. |
| 73 aura::Window* keyboard_container = | 73 aura::Window* keyboard_container = |
| 74 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); | 74 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); |
| 75 ASSERT_TRUE(keyboard_container); | 75 ASSERT_TRUE(keyboard_container); |
| 76 keyboard_container->Show(); | 76 keyboard_container->Show(); |
| 77 keyboard::KeyboardControllerProxy* proxy = keyboard_controller->proxy(); | 77 aura::Window* keyboard_window = |
| 78 aura::Window* keyboard_window = proxy->GetKeyboardWindow(); | 78 keyboard_controller->ui()->GetKeyboardWindow(); |
| 79 keyboard_container->AddChild(keyboard_window); | 79 keyboard_container->AddChild(keyboard_window); |
| 80 keyboard_window->set_owned_by_parent(false); | 80 keyboard_window->set_owned_by_parent(false); |
| 81 const int kKeyboardHeight = 200; | 81 const int kKeyboardHeight = 200; |
| 82 gfx::Rect keyboard_bounds = keyboard::FullWidthKeyboardBoundsFromRootBounds( | 82 gfx::Rect keyboard_bounds = keyboard::FullWidthKeyboardBoundsFromRootBounds( |
| 83 root_window->bounds(), kKeyboardHeight); | 83 root_window->bounds(), kKeyboardHeight); |
| 84 keyboard_window->SetBounds(keyboard_bounds); | 84 keyboard_window->SetBounds(keyboard_bounds); |
| 85 keyboard_window->Show(); | 85 keyboard_window->Show(); |
| 86 keyboard_controller->NotifyKeyboardBoundsChanging(keyboard_bounds); | 86 keyboard_controller->NotifyKeyboardBoundsChanging(keyboard_bounds); |
| 87 // Verify that test manager was notified of bounds change. | 87 // Verify that test manager was notified of bounds change. |
| 88 ASSERT_TRUE(manager->keyboard_bounds_changed()); | 88 ASSERT_TRUE(manager->keyboard_bounds_changed()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace test | 91 } // namespace test |
| 92 } // namespace ash | 92 } // namespace ash |
| OLD | NEW |