| 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/virtual_keyboard_controller.h" | 5 #include "ash/virtual_keyboard_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } | 44 } |
| 45 | 45 |
| 46 // Sets the event blocker on the maximized window controller. | 46 // Sets the event blocker on the maximized window controller. |
| 47 void SetEventBlocker( | 47 void SetEventBlocker( |
| 48 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> blocker) { | 48 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> blocker) { |
| 49 Shell::Get()->maximize_mode_controller()->event_blocker_ = | 49 Shell::Get()->maximize_mode_controller()->event_blocker_ = |
| 50 std::move(blocker); | 50 std::move(blocker); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void SetUp() override { | 53 void SetUp() override { |
| 54 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 55 keyboard::switches::kDisableSmartVirtualKeyboard); | |
| 56 AshTestBase::SetUp(); | 54 AshTestBase::SetUp(); |
| 57 UpdateKeyboardDevices(std::vector<ui::InputDevice>()); | 55 UpdateKeyboardDevices(std::vector<ui::InputDevice>()); |
| 58 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); | 56 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); |
| 59 } | 57 } |
| 60 | 58 |
| 61 private: | 59 private: |
| 62 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardControllerTest); | 60 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardControllerTest); |
| 63 }; | 61 }; |
| 64 | 62 |
| 65 TEST_F(VirtualKeyboardControllerTest, EnabledDuringMaximizeMode) { | |
| 66 ASSERT_FALSE(keyboard::IsKeyboardEnabled()); | |
| 67 // Toggle maximized mode on. | |
| 68 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | |
| 69 true); | |
| 70 EXPECT_TRUE(keyboard::IsKeyboardEnabled()); | |
| 71 // Toggle maximized mode off. | |
| 72 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | |
| 73 false); | |
| 74 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); | |
| 75 } | |
| 76 | |
| 77 // Mock event blocker that enables the internal keyboard when it's destructor | 63 // Mock event blocker that enables the internal keyboard when it's destructor |
| 78 // is called. | 64 // is called. |
| 79 class MockEventBlocker : public ScopedDisableInternalMouseAndKeyboard { | 65 class MockEventBlocker : public ScopedDisableInternalMouseAndKeyboard { |
| 80 public: | 66 public: |
| 81 MockEventBlocker() {} | 67 MockEventBlocker() {} |
| 82 ~MockEventBlocker() override { | 68 ~MockEventBlocker() override { |
| 83 std::vector<ui::InputDevice> keyboard_devices; | 69 std::vector<ui::InputDevice> keyboard_devices; |
| 84 keyboard_devices.push_back(ui::InputDevice( | 70 keyboard_devices.push_back(ui::InputDevice( |
| 85 1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "keyboard")); | 71 1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "keyboard")); |
| 86 ui::DeviceHotplugEventObserver* manager = | 72 ui::DeviceHotplugEventObserver* manager = |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 UpdateTouchscreenDevices(screens); | 308 UpdateTouchscreenDevices(screens); |
| 323 std::vector<ui::InputDevice> keyboard_devices; | 309 std::vector<ui::InputDevice> keyboard_devices; |
| 324 keyboard_devices.push_back(ui::InputDevice( | 310 keyboard_devices.push_back(ui::InputDevice( |
| 325 1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); | 311 1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); |
| 326 UpdateKeyboardDevices(keyboard_devices); | 312 UpdateKeyboardDevices(keyboard_devices); |
| 327 ASSERT_TRUE(keyboard::IsKeyboardEnabled()); | 313 ASSERT_TRUE(keyboard::IsKeyboardEnabled()); |
| 328 } | 314 } |
| 329 | 315 |
| 330 } // namespace test | 316 } // namespace test |
| 331 } // namespace ash | 317 } // namespace ash |
| OLD | NEW |