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 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 44 keyboard::switches::kDisableSmartVirtualKeyboard); |
43 AshTestBase::SetUp(); | 45 AshTestBase::SetUp(); |
44 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); | 46 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); |
45 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); | 47 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); |
46 } | 48 } |
47 | 49 |
48 private: | 50 private: |
49 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardControllerTest); | 51 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardControllerTest); |
50 }; | 52 }; |
51 | 53 |
52 TEST_F(VirtualKeyboardControllerTest, EnabledDuringMaximizeMode) { | 54 TEST_F(VirtualKeyboardControllerTest, EnabledDuringMaximizeMode) { |
(...skipping 10 matching lines...) Expand all Loading... |
63 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); | 65 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); |
64 } | 66 } |
65 | 67 |
66 class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest, | 68 class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest, |
67 public VirtualKeyboardObserver { | 69 public VirtualKeyboardObserver { |
68 public: | 70 public: |
69 VirtualKeyboardControllerAutoTest() : notified_(false), suppressed_(false) {} | 71 VirtualKeyboardControllerAutoTest() : notified_(false), suppressed_(false) {} |
70 ~VirtualKeyboardControllerAutoTest() override {} | 72 ~VirtualKeyboardControllerAutoTest() override {} |
71 | 73 |
72 void SetUp() override { | 74 void SetUp() override { |
73 CommandLine::ForCurrentProcess()->AppendSwitch( | 75 AshTestBase::SetUp(); |
74 keyboard::switches::kAutoVirtualKeyboard); | 76 // Set the current list of devices to empty so that they don't interfere |
75 VirtualKeyboardControllerTest::SetUp(); | 77 // with the test. |
| 78 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); |
| 79 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); |
76 Shell::GetInstance()->system_tray_notifier()->AddVirtualKeyboardObserver( | 80 Shell::GetInstance()->system_tray_notifier()->AddVirtualKeyboardObserver( |
77 this); | 81 this); |
78 } | 82 } |
79 | 83 |
80 void TearDown() override { | 84 void TearDown() override { |
81 Shell::GetInstance()->system_tray_notifier()->RemoveVirtualKeyboardObserver( | 85 Shell::GetInstance()->system_tray_notifier()->RemoveVirtualKeyboardObserver( |
82 this); | 86 this); |
83 AshTestBase::TearDown(); | 87 AshTestBase::TearDown(); |
84 } | 88 } |
85 | 89 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 keyboards.push_back(ui::KeyboardDevice( | 197 keyboards.push_back(ui::KeyboardDevice( |
194 2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); | 198 2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); |
195 keyboards.push_back(ui::KeyboardDevice( | 199 keyboards.push_back(ui::KeyboardDevice( |
196 3, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); | 200 3, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); |
197 UpdateKeyboardDevices(keyboards); | 201 UpdateKeyboardDevices(keyboards); |
198 ASSERT_FALSE(keyboard::IsKeyboardEnabled()); | 202 ASSERT_FALSE(keyboard::IsKeyboardEnabled()); |
199 } | 203 } |
200 | 204 |
201 } // namespace test | 205 } // namespace test |
202 } // namespace ash | 206 } // namespace ash |
OLD | NEW |