| 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/common/workspace/workspace_layout_manager_delegate.h" |
| 11 #include "ash/wm/workspace/workspace_layout_manager.h" | 12 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 13 #include "ui/keyboard/keyboard_controller.h" | 14 #include "ui/keyboard/keyboard_controller.h" |
| 14 #include "ui/keyboard/keyboard_switches.h" | 15 #include "ui/keyboard/keyboard_switches.h" |
| 15 #include "ui/keyboard/keyboard_ui.h" | 16 #include "ui/keyboard/keyboard_ui.h" |
| 16 #include "ui/keyboard/keyboard_util.h" | 17 #include "ui/keyboard/keyboard_util.h" |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 namespace test { | 20 namespace test { |
| 20 | 21 |
| 21 class VirtualKeyboardAlwaysOnTopControllerTest : public AshTestBase { | 22 class VirtualKeyboardAlwaysOnTopControllerTest : public AshTestBase { |
| 22 public: | 23 public: |
| 23 VirtualKeyboardAlwaysOnTopControllerTest() {} | 24 VirtualKeyboardAlwaysOnTopControllerTest() {} |
| 24 ~VirtualKeyboardAlwaysOnTopControllerTest() override {} | 25 ~VirtualKeyboardAlwaysOnTopControllerTest() override {} |
| 25 | 26 |
| 26 void SetUp() override { | 27 void SetUp() override { |
| 27 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 28 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 28 keyboard::switches::kEnableVirtualKeyboard); | 29 keyboard::switches::kEnableVirtualKeyboard); |
| 29 test::AshTestBase::SetUp(); | 30 test::AshTestBase::SetUp(); |
| 30 } | 31 } |
| 31 | 32 |
| 32 private: | 33 private: |
| 33 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardAlwaysOnTopControllerTest); | 34 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardAlwaysOnTopControllerTest); |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 class TestLayoutManager : public WorkspaceLayoutManager { | 37 class TestLayoutManager : public WorkspaceLayoutManager { |
| 37 public: | 38 public: |
| 38 explicit TestLayoutManager(aura::Window* window) | 39 explicit TestLayoutManager(aura::Window* window) |
| 39 : WorkspaceLayoutManager(window), keyboard_bounds_changed_(false) {} | 40 : WorkspaceLayoutManager(window, nullptr), |
| 41 keyboard_bounds_changed_(false) {} |
| 40 | 42 |
| 41 ~TestLayoutManager() override {} | 43 ~TestLayoutManager() override {} |
| 42 | 44 |
| 43 void OnKeyboardBoundsChanging(const gfx::Rect& bounds) override { | 45 void OnKeyboardBoundsChanging(const gfx::Rect& bounds) override { |
| 44 keyboard_bounds_changed_ = true; | 46 keyboard_bounds_changed_ = true; |
| 45 WorkspaceLayoutManager::OnKeyboardBoundsChanging(bounds); | 47 WorkspaceLayoutManager::OnKeyboardBoundsChanging(bounds); |
| 46 } | 48 } |
| 47 | 49 |
| 48 bool keyboard_bounds_changed() const { return keyboard_bounds_changed_; } | 50 bool keyboard_bounds_changed() const { return keyboard_bounds_changed_; } |
| 49 | 51 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 root_window->bounds(), kKeyboardHeight); | 85 root_window->bounds(), kKeyboardHeight); |
| 84 keyboard_window->SetBounds(keyboard_bounds); | 86 keyboard_window->SetBounds(keyboard_bounds); |
| 85 keyboard_window->Show(); | 87 keyboard_window->Show(); |
| 86 keyboard_controller->NotifyKeyboardBoundsChanging(keyboard_bounds); | 88 keyboard_controller->NotifyKeyboardBoundsChanging(keyboard_bounds); |
| 87 // Verify that test manager was notified of bounds change. | 89 // Verify that test manager was notified of bounds change. |
| 88 ASSERT_TRUE(manager->keyboard_bounds_changed()); | 90 ASSERT_TRUE(manager->keyboard_bounds_changed()); |
| 89 } | 91 } |
| 90 | 92 |
| 91 } // namespace test | 93 } // namespace test |
| 92 } // namespace ash | 94 } // namespace ash |
| OLD | NEW |