OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/common/system/chromeos/ime_menu/ime_menu_tray.h" | 5 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" |
6 | 6 |
7 #include "ash/common/accelerators/accelerator_controller.h" | 7 #include "ash/common/accelerators/accelerator_controller.h" |
| 8 #include "ash/common/accessibility_delegate.h" |
8 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" | 9 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" |
9 #include "ash/common/system/status_area_widget.h" | 10 #include "ash/common/system/status_area_widget.h" |
10 #include "ash/common/system/tray/ime_info.h" | 11 #include "ash/common/system/tray/ime_info.h" |
11 #include "ash/common/system/tray/system_tray_notifier.h" | 12 #include "ash/common/system/tray/system_tray_notifier.h" |
12 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
13 #include "ash/test/ash_test_base.h" | 14 #include "ash/test/ash_test_base.h" |
14 #include "ash/test/status_area_widget_test_helper.h" | 15 #include "ash/test/status_area_widget_test_helper.h" |
15 #include "ash/test/test_system_tray_delegate.h" | 16 #include "ash/test/test_system_tray_delegate.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
17 #include "ui/accessibility/ax_view_state.h" | 18 #include "ui/accessibility/ax_view_state.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 EXPECT_TRUE(IsTrayBackgroundActive()); | 230 EXPECT_TRUE(IsTrayBackgroundActive()); |
230 EXPECT_TRUE(IsBubbleShown()); | 231 EXPECT_TRUE(IsBubbleShown()); |
231 | 232 |
232 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), | 233 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
233 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 234 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
234 GetTray()->PerformAction(tap); | 235 GetTray()->PerformAction(tap); |
235 EXPECT_FALSE(IsTrayBackgroundActive()); | 236 EXPECT_FALSE(IsTrayBackgroundActive()); |
236 EXPECT_FALSE(IsBubbleShown()); | 237 EXPECT_FALSE(IsBubbleShown()); |
237 } | 238 } |
238 | 239 |
| 240 TEST_F(ImeMenuTrayTest, ShowEmojiKeyset) { |
| 241 WmShell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(true); |
| 242 ASSERT_TRUE(IsVisible()); |
| 243 ASSERT_FALSE(IsTrayBackgroundActive()); |
| 244 |
| 245 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
| 246 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
| 247 GetTray()->PerformAction(tap); |
| 248 EXPECT_TRUE(IsTrayBackgroundActive()); |
| 249 EXPECT_TRUE(IsBubbleShown()); |
| 250 |
| 251 AccessibilityDelegate* accessibility_delegate = |
| 252 WmShell::Get()->accessibility_delegate(); |
| 253 |
| 254 accessibility_delegate->SetVirtualKeyboardEnabled(true); |
| 255 EXPECT_TRUE(accessibility_delegate->IsVirtualKeyboardEnabled()); |
| 256 |
| 257 GetTray()->ShowKeyboardWithKeyset("emoji"); |
| 258 // The menu should be hidden. |
| 259 EXPECT_FALSE(IsBubbleShown()); |
| 260 // The virtual keyboard should be enabled. |
| 261 EXPECT_TRUE(accessibility_delegate->IsVirtualKeyboardEnabled()); |
| 262 |
| 263 // Hides the keyboard. |
| 264 GetTray()->OnKeyboardHidden(); |
| 265 // The keyboard should still be enabled. |
| 266 EXPECT_TRUE(accessibility_delegate->IsVirtualKeyboardEnabled()); |
| 267 } |
| 268 |
| 269 TEST_F(ImeMenuTrayTest, ForceToShowEmojiKeyset) { |
| 270 AccessibilityDelegate* accessibility_delegate = |
| 271 WmShell::Get()->accessibility_delegate(); |
| 272 accessibility_delegate->SetVirtualKeyboardEnabled(false); |
| 273 ASSERT_FALSE(accessibility_delegate->IsVirtualKeyboardEnabled()); |
| 274 |
| 275 GetTray()->ShowKeyboardWithKeyset("emoji"); |
| 276 // The virtual keyboard should be enabled. |
| 277 EXPECT_TRUE(accessibility_delegate->IsVirtualKeyboardEnabled()); |
| 278 |
| 279 // Hides the keyboard. |
| 280 GetTray()->OnKeyboardHidden(); |
| 281 // The keyboard should still be disabled. |
| 282 EXPECT_FALSE(accessibility_delegate->IsVirtualKeyboardEnabled()); |
| 283 } |
| 284 |
239 } // namespace ash | 285 } // namespace ash |
OLD | NEW |