Chromium Code Reviews| Index: ash/common/system/chromeos/ime_menu/ime_menu_tray_unittest.cc |
| diff --git a/ash/common/system/chromeos/ime_menu/ime_menu_tray_unittest.cc b/ash/common/system/chromeos/ime_menu/ime_menu_tray_unittest.cc |
| index 9acd847f322645c731ced56b4e59194b6ad1b1cf..aca9ac493181b82360a7a46d2aa1f87d3513668f 100644 |
| --- a/ash/common/system/chromeos/ime_menu/ime_menu_tray_unittest.cc |
| +++ b/ash/common/system/chromeos/ime_menu/ime_menu_tray_unittest.cc |
| @@ -5,6 +5,7 @@ |
| #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" |
| #include "ash/common/accelerators/accelerator_controller.h" |
| +#include "ash/common/accessibility_delegate.h" |
| #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" |
| #include "ash/common/system/status_area_widget.h" |
| #include "ash/common/system/tray/ime_info.h" |
| @@ -236,4 +237,50 @@ TEST_F(ImeMenuTrayTest, TestAccelerator) { |
| EXPECT_FALSE(IsBubbleShown()); |
| } |
| +TEST_F(ImeMenuTrayTest, ShowEmojiKeyset) { |
| + WmShell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(true); |
| + ASSERT_TRUE(IsVisible()); |
| + ASSERT_FALSE(IsTrayBackgroundActive()); |
| + |
| + ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
| + ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
| + GetTray()->PerformAction(tap); |
| + EXPECT_TRUE(IsTrayBackgroundActive()); |
| + EXPECT_TRUE(IsBubbleShown()); |
| + |
| + WmShell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(true); |
|
James Cook
2016/09/14 21:14:28
optional: The lines might wrap a little better if
Azure Wei
2016/09/15 03:44:51
Done.
|
| + ASSERT_TRUE( |
| + WmShell::Get()->accessibility_delegate()->IsVirtualKeyboardEnabled()); |
| + |
| + GetTray()->ShowKeyboardWithKeyset("emoji"); |
| + // The menu should be hidden. |
| + EXPECT_FALSE(IsBubbleShown()); |
| + // The virtual keyboard should be enabled. |
| + ASSERT_TRUE( |
|
James Cook
2016/09/14 21:14:28
nit: This and below could be EXPECT_TRUE. In gener
Azure Wei
2016/09/15 03:44:51
Done. Thanks.
|
| + WmShell::Get()->accessibility_delegate()->IsVirtualKeyboardEnabled()); |
| + |
| + // Hides the keyboard. |
| + GetTray()->OnKeyboardHidden(); |
| + // The keyboard should still be enabled. |
| + ASSERT_TRUE( |
| + WmShell::Get()->accessibility_delegate()->IsVirtualKeyboardEnabled()); |
| +} |
| + |
| +TEST_F(ImeMenuTrayTest, ForceToShowEmojiKeyset) { |
| + WmShell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(false); |
| + ASSERT_FALSE( |
| + WmShell::Get()->accessibility_delegate()->IsVirtualKeyboardEnabled()); |
| + |
| + GetTray()->ShowKeyboardWithKeyset("emoji"); |
| + // The virtual keyboard should be enabled. |
| + ASSERT_TRUE( |
|
James Cook
2016/09/14 21:14:27
ditto
Azure Wei
2016/09/15 03:44:51
Done.
|
| + WmShell::Get()->accessibility_delegate()->IsVirtualKeyboardEnabled()); |
| + |
| + // Hides the keyboard. |
| + GetTray()->OnKeyboardHidden(); |
| + // The keyboard should still be disabled. |
| + ASSERT_FALSE( |
| + WmShell::Get()->accessibility_delegate()->IsVirtualKeyboardEnabled()); |
| +} |
|
James Cook
2016/09/14 21:14:27
Thanks for adding nice, simple tests!
|
| + |
| } // namespace ash |