| 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 "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_observer.h" | 8 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_observer.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 10 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 manager->OnTouchscreenDevicesUpdated(touchscreen_devices); | 33 manager->OnTouchscreenDevicesUpdated(touchscreen_devices); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void UpdateKeyboardDevices(std::vector<ui::KeyboardDevice> keyboard_devices) { | 36 void UpdateKeyboardDevices(std::vector<ui::KeyboardDevice> keyboard_devices) { |
| 37 ui::DeviceHotplugEventObserver* manager = | 37 ui::DeviceHotplugEventObserver* manager = |
| 38 ui::DeviceDataManager::GetInstance(); | 38 ui::DeviceDataManager::GetInstance(); |
| 39 manager->OnKeyboardDevicesUpdated(keyboard_devices); | 39 manager->OnKeyboardDevicesUpdated(keyboard_devices); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void SetUp() override { | 42 void SetUp() override { |
| 43 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 44 keyboard::switches::kDisableSmartVirtualKeyboard); | |
| 45 AshTestBase::SetUp(); | 43 AshTestBase::SetUp(); |
| 46 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); | 44 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); |
| 47 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); | 45 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); |
| 48 } | 46 } |
| 49 | 47 |
| 50 private: | 48 private: |
| 51 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardControllerTest); | 49 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardControllerTest); |
| 52 }; | 50 }; |
| 53 | 51 |
| 54 TEST_F(VirtualKeyboardControllerTest, EnabledDuringMaximizeMode) { | 52 TEST_F(VirtualKeyboardControllerTest, EnabledDuringMaximizeMode) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 65 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); | 63 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); |
| 66 } | 64 } |
| 67 | 65 |
| 68 class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest, | 66 class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest, |
| 69 public VirtualKeyboardObserver { | 67 public VirtualKeyboardObserver { |
| 70 public: | 68 public: |
| 71 VirtualKeyboardControllerAutoTest() : notified_(false), suppressed_(false) {} | 69 VirtualKeyboardControllerAutoTest() : notified_(false), suppressed_(false) {} |
| 72 ~VirtualKeyboardControllerAutoTest() override {} | 70 ~VirtualKeyboardControllerAutoTest() override {} |
| 73 | 71 |
| 74 void SetUp() override { | 72 void SetUp() override { |
| 73 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 74 keyboard::switches::kAutoVirtualKeyboard); |
| 75 AshTestBase::SetUp(); | 75 AshTestBase::SetUp(); |
| 76 // Set the current list of devices to empty so that they don't interfere | 76 // Set the current list of devices to empty so that they don't interfere |
| 77 // with the test. | 77 // with the test. |
| 78 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); | 78 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); |
| 79 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); | 79 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); |
| 80 Shell::GetInstance()->system_tray_notifier()->AddVirtualKeyboardObserver( | 80 Shell::GetInstance()->system_tray_notifier()->AddVirtualKeyboardObserver( |
| 81 this); | 81 this); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void TearDown() override { | 84 void TearDown() override { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 keyboards.push_back(ui::KeyboardDevice( | 197 keyboards.push_back(ui::KeyboardDevice( |
| 198 2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); | 198 2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); |
| 199 keyboards.push_back(ui::KeyboardDevice( | 199 keyboards.push_back(ui::KeyboardDevice( |
| 200 3, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); | 200 3, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); |
| 201 UpdateKeyboardDevices(keyboards); | 201 UpdateKeyboardDevices(keyboards); |
| 202 ASSERT_FALSE(keyboard::IsKeyboardEnabled()); | 202 ASSERT_FALSE(keyboard::IsKeyboardEnabled()); |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace test | 205 } // namespace test |
| 206 } // namespace ash | 206 } // namespace ash |
| OLD | NEW |