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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_observer.h" | 10 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_observer.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 // Whether the observer method was called. | 147 // Whether the observer method was called. |
148 bool notified_; | 148 bool notified_; |
149 | 149 |
150 // Whether the keeyboard is suppressed. | 150 // Whether the keeyboard is suppressed. |
151 bool suppressed_; | 151 bool suppressed_; |
152 | 152 |
153 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardControllerAutoTest); | 153 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardControllerAutoTest); |
154 }; | 154 }; |
155 | 155 |
156 // Tests that the onscreen keyboard is disabled if an internal keyboard is | 156 // Tests that the onscreen keyboard is disabled if an internal keyboard is |
157 // present. | 157 // present. |
pkotwicz
2015/03/02 20:35:57
Maybe update this comment?
rsadam
2015/03/02 22:01:37
Done.
| |
158 TEST_F(VirtualKeyboardControllerAutoTest, DisabledIfInternalKeyboardPresent) { | 158 TEST_F(VirtualKeyboardControllerAutoTest, DisabledIfInternalKeyboardPresent) { |
159 std::vector<ui::TouchscreenDevice> screens; | 159 std::vector<ui::TouchscreenDevice> screens; |
160 screens.push_back(ui::TouchscreenDevice( | 160 screens.push_back(ui::TouchscreenDevice( |
161 1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, gfx::Size(1024, 768), 0)); | 161 1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, gfx::Size(1024, 768), 0)); |
162 UpdateTouchscreenDevices(screens); | 162 UpdateTouchscreenDevices(screens); |
163 std::vector<ui::KeyboardDevice> keyboards; | 163 std::vector<ui::KeyboardDevice> keyboards; |
164 keyboards.push_back( | 164 keyboards.push_back( |
165 ui::KeyboardDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL)); | 165 ui::KeyboardDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL)); |
166 UpdateKeyboardDevices(keyboards); | 166 UpdateKeyboardDevices(keyboards); |
167 ASSERT_FALSE(keyboard::IsKeyboardEnabled()); | 167 ASSERT_FALSE(keyboard::IsKeyboardEnabled()); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 keyboards.push_back( | 228 keyboards.push_back( |
229 ui::KeyboardDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL)); | 229 ui::KeyboardDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL)); |
230 keyboards.push_back( | 230 keyboards.push_back( |
231 ui::KeyboardDevice(2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL)); | 231 ui::KeyboardDevice(2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL)); |
232 keyboards.push_back( | 232 keyboards.push_back( |
233 ui::KeyboardDevice(3, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL)); | 233 ui::KeyboardDevice(3, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL)); |
234 UpdateKeyboardDevices(keyboards); | 234 UpdateKeyboardDevices(keyboards); |
235 ASSERT_FALSE(keyboard::IsKeyboardEnabled()); | 235 ASSERT_FALSE(keyboard::IsKeyboardEnabled()); |
236 } | 236 } |
237 | 237 |
238 // Tests maximized mode interaction without disabling the internal keyboard. | |
pkotwicz
2015/03/02 20:35:57
A test that the virtual keyboard is surpressed if
rsadam
2015/03/02 22:01:37
Done.
| |
239 TEST_F(VirtualKeyboardControllerAutoTest, EnabledDuringMaximizeMode) { | |
240 std::vector<ui::TouchscreenDevice> screens; | |
241 screens.push_back(ui::TouchscreenDevice( | |
242 1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, gfx::Size(1024, 768), 0)); | |
243 UpdateTouchscreenDevices(screens); | |
244 std::vector<ui::KeyboardDevice> keyboards; | |
245 keyboards.push_back( | |
246 ui::KeyboardDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL)); | |
247 UpdateKeyboardDevices(keyboards); | |
248 ASSERT_FALSE(keyboard::IsKeyboardEnabled()); | |
249 // Toggle maximized mode on. | |
250 Shell::GetInstance() | |
251 ->maximize_mode_controller() | |
252 ->EnableMaximizeModeWindowManager(true); | |
253 ASSERT_TRUE(keyboard::IsKeyboardEnabled()); | |
254 // Toggle maximized mode off. | |
255 Shell::GetInstance() | |
256 ->maximize_mode_controller() | |
257 ->EnableMaximizeModeWindowManager(false); | |
258 ASSERT_FALSE(keyboard::IsKeyboardEnabled()); | |
259 } | |
260 | |
238 class VirtualKeyboardControllerAlwaysEnabledTest | 261 class VirtualKeyboardControllerAlwaysEnabledTest |
239 : public VirtualKeyboardControllerAutoTest { | 262 : public VirtualKeyboardControllerAutoTest { |
240 public: | 263 public: |
241 VirtualKeyboardControllerAlwaysEnabledTest() | 264 VirtualKeyboardControllerAlwaysEnabledTest() |
242 : VirtualKeyboardControllerAutoTest() {} | 265 : VirtualKeyboardControllerAutoTest() {} |
243 ~VirtualKeyboardControllerAlwaysEnabledTest() override {} | 266 ~VirtualKeyboardControllerAlwaysEnabledTest() override {} |
244 | 267 |
245 void SetUp() override { | 268 void SetUp() override { |
246 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 269 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
247 keyboard::switches::kEnableVirtualKeyboard); | 270 keyboard::switches::kEnableVirtualKeyboard); |
(...skipping 13 matching lines...) Expand all Loading... | |
261 UpdateTouchscreenDevices(screens); | 284 UpdateTouchscreenDevices(screens); |
262 std::vector<ui::KeyboardDevice> keyboards; | 285 std::vector<ui::KeyboardDevice> keyboards; |
263 keyboards.push_back( | 286 keyboards.push_back( |
264 ui::KeyboardDevice(1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL)); | 287 ui::KeyboardDevice(1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL)); |
265 UpdateKeyboardDevices(keyboards); | 288 UpdateKeyboardDevices(keyboards); |
266 ASSERT_TRUE(keyboard::IsKeyboardEnabled()); | 289 ASSERT_TRUE(keyboard::IsKeyboardEnabled()); |
267 } | 290 } |
268 | 291 |
269 } // namespace test | 292 } // namespace test |
270 } // namespace ash | 293 } // namespace ash |
OLD | NEW |