diff options
author | rsadam <rsadam@chromium.org> | 2015-01-15 17:08:11 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-16 01:09:03 +0000 |
commit | f478ba76470d6afdc107ff7b93529b4d3e907dbd (patch) | |
tree | f065e4e5cfd4a749cf5c76689245e4add2d23e2f /ash | |
parent | fb1af21386336e05c974993234ab0be9c17e3722 (diff) | |
download | chromium_src-f478ba76470d6afdc107ff7b93529b4d3e907dbd.zip chromium_src-f478ba76470d6afdc107ff7b93529b4d3e907dbd.tar.gz chromium_src-f478ba76470d6afdc107ff7b93529b4d3e907dbd.tar.bz2 |
Updates SmartDeploy to respect EnableVirtualKeyboard flag.
BUG=448880
TEST=VirtualKeyboardControllerAlwaysEnabledTest.DoesNotSuppressKeyboard
Review URL: https://codereview.chromium.org/855443002
Cr-Commit-Position: refs/heads/master@{#311805}
Diffstat (limited to 'ash')
-rw-r--r-- | ash/virtual_keyboard_controller.cc | 5 | ||||
-rw-r--r-- | ash/virtual_keyboard_controller_unittest.cc | 33 |
2 files changed, 38 insertions, 0 deletions
diff --git a/ash/virtual_keyboard_controller.cc b/ash/virtual_keyboard_controller.cc index 1f8a3ce..d661603 100644 --- a/ash/virtual_keyboard_controller.cc +++ b/ash/virtual_keyboard_controller.cc @@ -8,6 +8,7 @@ #include "ash/shell.h" #include "ash/wm/maximize_mode/maximize_mode_controller.h" +#include "ash_switches.h" #include "base/command_line.h" #include "base/strings/string_util.h" #include "ui/events/devices/device_data_manager.h" @@ -23,6 +24,10 @@ namespace { // Checks whether smart deployment is enabled. bool IsSmartVirtualKeyboardEnabled() { + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + keyboard::switches::kEnableVirtualKeyboard)) { + return false; + } return base::CommandLine::ForCurrentProcess()->HasSwitch( keyboard::switches::kEnableAutoVirtualKeyboard); } diff --git a/ash/virtual_keyboard_controller_unittest.cc b/ash/virtual_keyboard_controller_unittest.cc index 27dcf90..7a6d676 100644 --- a/ash/virtual_keyboard_controller_unittest.cc +++ b/ash/virtual_keyboard_controller_unittest.cc @@ -11,6 +11,7 @@ #include "ash/test/ash_test_base.h" #include "ash/wm/maximize_mode/maximize_mode_controller.h" #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard.h" +#include "ash_switches.h" #include "base/command_line.h" #include "ui/events/devices/device_data_manager.h" #include "ui/events/devices/device_hotplug_event_observer.h" @@ -237,5 +238,37 @@ TEST_F(VirtualKeyboardControllerAutoTest, HandleMultipleKeyboardsPresent) { ASSERT_FALSE(keyboard::IsKeyboardEnabled()); } +class VirtualKeyboardControllerAlwaysEnabledTest + : public VirtualKeyboardControllerAutoTest { + public: + VirtualKeyboardControllerAlwaysEnabledTest() + : VirtualKeyboardControllerAutoTest() {} + ~VirtualKeyboardControllerAlwaysEnabledTest() override {} + + void SetUp() override { + base::CommandLine::ForCurrentProcess()->AppendSwitch( + keyboard::switches::kEnableVirtualKeyboard); + VirtualKeyboardControllerAutoTest::SetUp(); + } + + private: + DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardControllerAlwaysEnabledTest); +}; + +// Tests that the controller cannot suppress the keyboard if the virtual +// keyboard always enabled flag is active. +TEST_F(VirtualKeyboardControllerAlwaysEnabledTest, DoesNotSuppressKeyboard) { + std::vector<ui::TouchscreenDevice> screens; + screens.push_back( + ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, + "Touchscreen", gfx::Size(1024, 768), 0)); + UpdateTouchscreenDevices(screens); + std::vector<ui::KeyboardDevice> keyboards; + keyboards.push_back(ui::KeyboardDevice( + 1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); + UpdateKeyboardDevices(keyboards); + ASSERT_TRUE(keyboard::IsKeyboardEnabled()); +} + } // namespace test } // namespace ash |