Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2756)

Unified Diff: ash/virtual_keyboard_controller_unittest.cc

Issue 970983003: Fix Virtual Keyboard not being deployed in TouchView mode on Ozone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added suppression test. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/virtual_keyboard_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/virtual_keyboard_controller_unittest.cc
diff --git a/ash/virtual_keyboard_controller_unittest.cc b/ash/virtual_keyboard_controller_unittest.cc
index f3d169b3a9c24f2dc51a89eaf27d0021a84dad6b..7ca7a2aeef814df2cb3c1a6369f1f9241673811f 100644
--- a/ash/virtual_keyboard_controller_unittest.cc
+++ b/ash/virtual_keyboard_controller_unittest.cc
@@ -154,7 +154,7 @@ class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest,
};
// Tests that the onscreen keyboard is disabled if an internal keyboard is
-// present.
+// present and maximized mode is disabled.
TEST_F(VirtualKeyboardControllerAutoTest, DisabledIfInternalKeyboardPresent) {
std::vector<ui::TouchscreenDevice> screens;
screens.push_back(ui::TouchscreenDevice(
@@ -235,6 +235,79 @@ TEST_F(VirtualKeyboardControllerAutoTest, HandleMultipleKeyboardsPresent) {
ASSERT_FALSE(keyboard::IsKeyboardEnabled());
}
+// Tests maximized mode interaction without disabling the internal keyboard.
+TEST_F(VirtualKeyboardControllerAutoTest, EnabledDuringMaximizeMode) {
+ std::vector<ui::TouchscreenDevice> screens;
+ screens.push_back(ui::TouchscreenDevice(
+ 1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, gfx::Size(1024, 768), 0));
+ UpdateTouchscreenDevices(screens);
+ std::vector<ui::KeyboardDevice> keyboards;
+ keyboards.push_back(
+ ui::KeyboardDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL));
+ UpdateKeyboardDevices(keyboards);
+ ASSERT_FALSE(keyboard::IsKeyboardEnabled());
+ // Toggle maximized mode on.
+ Shell::GetInstance()
+ ->maximize_mode_controller()
+ ->EnableMaximizeModeWindowManager(true);
+ ASSERT_TRUE(keyboard::IsKeyboardEnabled());
+ // Toggle maximized mode off.
+ Shell::GetInstance()
+ ->maximize_mode_controller()
+ ->EnableMaximizeModeWindowManager(false);
+ ASSERT_FALSE(keyboard::IsKeyboardEnabled());
+}
+
+// Tests that keyboard gets suppressed in maximized mode.
+TEST_F(VirtualKeyboardControllerAutoTest, SuppressedInMaximizedMode) {
+ std::vector<ui::TouchscreenDevice> screens;
+ screens.push_back(ui::TouchscreenDevice(
+ 1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, gfx::Size(1024, 768), 0));
+ UpdateTouchscreenDevices(screens);
+ std::vector<ui::KeyboardDevice> keyboards;
+ keyboards.push_back(
+ ui::KeyboardDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL));
+ keyboards.push_back(
+ ui::KeyboardDevice(2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL));
+ UpdateKeyboardDevices(keyboards);
+ // Toggle maximized mode on.
+ Shell::GetInstance()
+ ->maximize_mode_controller()
+ ->EnableMaximizeModeWindowManager(true);
+ ASSERT_FALSE(keyboard::IsKeyboardEnabled());
+ ASSERT_TRUE(notified());
+ ASSERT_TRUE(IsVirtualKeyboardSuppressed());
+ // Toggle show keyboard. Keyboard should be visible.
+ ResetObserver();
+ Shell::GetInstance()
+ ->virtual_keyboard_controller()
+ ->ToggleIgnoreExternalKeyboard();
+ ASSERT_TRUE(keyboard::IsKeyboardEnabled());
+ ASSERT_TRUE(notified());
+ ASSERT_TRUE(IsVirtualKeyboardSuppressed());
+ // Toggle show keyboard. Keyboard should be hidden.
+ ResetObserver();
+ Shell::GetInstance()
+ ->virtual_keyboard_controller()
+ ->ToggleIgnoreExternalKeyboard();
+ ASSERT_FALSE(keyboard::IsKeyboardEnabled());
+ ASSERT_TRUE(notified());
+ ASSERT_TRUE(IsVirtualKeyboardSuppressed());
+ // Remove external keyboard. Should be notified that the keyboard is not
+ // suppressed.
+ ResetObserver();
+ keyboards.pop_back();
+ UpdateKeyboardDevices(keyboards);
+ ASSERT_TRUE(keyboard::IsKeyboardEnabled());
+ ASSERT_TRUE(notified());
+ ASSERT_FALSE(IsVirtualKeyboardSuppressed());
+ // Toggle maximized mode oFF.
+ Shell::GetInstance()
+ ->maximize_mode_controller()
+ ->EnableMaximizeModeWindowManager(false);
+ ASSERT_FALSE(keyboard::IsKeyboardEnabled());
+}
+
class VirtualKeyboardControllerAlwaysEnabledTest
: public VirtualKeyboardControllerAutoTest {
public:
« no previous file with comments | « ash/virtual_keyboard_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698