| 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/system/ime_menu/ime_menu_tray.h" | 5 #include "ash/system/ime_menu/ime_menu_tray.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/accessibility_delegate.h" | 8 #include "ash/accessibility_delegate.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/system/ime_menu/ime_list_view.h" | 10 #include "ash/system/ime_menu/ime_list_view.h" |
| 11 #include "ash/system/status_area_widget.h" | 11 #include "ash/system/status_area_widget.h" |
| 12 #include "ash/system/tray/ime_info.h" | 12 #include "ash/system/tray/ime_info.h" |
| 13 #include "ash/system/tray/system_tray_notifier.h" | 13 #include "ash/system/tray/system_tray_notifier.h" |
| 14 #include "ash/test/ash_test_base.h" | 14 #include "ash/test/ash_test_base.h" |
| 15 #include "ash/test/status_area_widget_test_helper.h" | 15 #include "ash/test/status_area_widget_test_helper.h" |
| 16 #include "ash/test/test_system_tray_delegate.h" | 16 #include "ash/test/test_system_tray_delegate.h" |
| 17 #include "base/run_loop.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 18 #include "ui/accessibility/ax_node_data.h" | 19 #include "ui/accessibility/ax_node_data.h" |
| 19 #include "ui/base/ime/chromeos/input_method_manager.h" | 20 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 20 #include "ui/base/ime/chromeos/mock_input_method_manager.h" | 21 #include "ui/base/ime/chromeos/mock_input_method_manager.h" |
| 21 #include "ui/base/ime/ime_bridge.h" | 22 #include "ui/base/ime/ime_bridge.h" |
| 22 #include "ui/base/ime/text_input_flags.h" | 23 #include "ui/base/ime/text_input_flags.h" |
| 23 #include "ui/events/event.h" | 24 #include "ui/events/event.h" |
| 24 #include "ui/views/controls/label.h" | 25 #include "ui/views/controls/label.h" |
| 25 | 26 |
| 26 using base::UTF8ToUTF16; | 27 using base::UTF8ToUTF16; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 Shell::Get()->accessibility_delegate(); | 291 Shell::Get()->accessibility_delegate(); |
| 291 accessibility_delegate->SetVirtualKeyboardEnabled(false); | 292 accessibility_delegate->SetVirtualKeyboardEnabled(false); |
| 292 ASSERT_FALSE(accessibility_delegate->IsVirtualKeyboardEnabled()); | 293 ASSERT_FALSE(accessibility_delegate->IsVirtualKeyboardEnabled()); |
| 293 | 294 |
| 294 GetTray()->ShowKeyboardWithKeyset("emoji"); | 295 GetTray()->ShowKeyboardWithKeyset("emoji"); |
| 295 // The virtual keyboard should be enabled. | 296 // The virtual keyboard should be enabled. |
| 296 EXPECT_TRUE(accessibility_delegate->IsVirtualKeyboardEnabled()); | 297 EXPECT_TRUE(accessibility_delegate->IsVirtualKeyboardEnabled()); |
| 297 | 298 |
| 298 // Hides the keyboard. | 299 // Hides the keyboard. |
| 299 GetTray()->OnKeyboardHidden(); | 300 GetTray()->OnKeyboardHidden(); |
| 300 // The keyboard should still be disabled. | 301 // The keyboard should still be disabled, which is a posted task. |
| 302 base::RunLoop().RunUntilIdle(); |
| 301 EXPECT_FALSE(accessibility_delegate->IsVirtualKeyboardEnabled()); | 303 EXPECT_FALSE(accessibility_delegate->IsVirtualKeyboardEnabled()); |
| 302 } | 304 } |
| 303 | 305 |
| 304 TEST_F(ImeMenuTrayTest, ShowEmojiHandwritingVoiceButtons) { | 306 TEST_F(ImeMenuTrayTest, ShowEmojiHandwritingVoiceButtons) { |
| 305 FocusInInputContext(ui::TEXT_INPUT_TYPE_TEXT); | 307 FocusInInputContext(ui::TEXT_INPUT_TYPE_TEXT); |
| 306 EXPECT_FALSE(GetTray()->ShouldShowEmojiHandwritingVoiceButtons()); | 308 EXPECT_FALSE(GetTray()->ShouldShowEmojiHandwritingVoiceButtons()); |
| 307 | 309 |
| 308 chromeos::input_method::InputMethodManager* input_method_manager = | 310 chromeos::input_method::InputMethodManager* input_method_manager = |
| 309 chromeos::input_method::InputMethodManager::Get(); | 311 chromeos::input_method::InputMethodManager::Get(); |
| 310 EXPECT_FALSE(input_method_manager); | 312 EXPECT_FALSE(input_method_manager); |
| 311 chromeos::input_method::InputMethodManager::Initialize( | 313 chromeos::input_method::InputMethodManager::Initialize( |
| 312 new chromeos::input_method::MockInputMethodManager); | 314 new chromeos::input_method::MockInputMethodManager); |
| 313 input_method_manager = chromeos::input_method::InputMethodManager::Get(); | 315 input_method_manager = chromeos::input_method::InputMethodManager::Get(); |
| 314 EXPECT_TRUE(input_method_manager && | 316 EXPECT_TRUE(input_method_manager && |
| 315 input_method_manager->IsEmojiHandwritingVoiceOnImeMenuEnabled()); | 317 input_method_manager->IsEmojiHandwritingVoiceOnImeMenuEnabled()); |
| 316 EXPECT_TRUE(GetTray()->ShouldShowEmojiHandwritingVoiceButtons()); | 318 EXPECT_TRUE(GetTray()->ShouldShowEmojiHandwritingVoiceButtons()); |
| 317 | 319 |
| 318 FocusInInputContext(ui::TEXT_INPUT_TYPE_PASSWORD); | 320 FocusInInputContext(ui::TEXT_INPUT_TYPE_PASSWORD); |
| 319 EXPECT_FALSE(GetTray()->ShouldShowEmojiHandwritingVoiceButtons()); | 321 EXPECT_FALSE(GetTray()->ShouldShowEmojiHandwritingVoiceButtons()); |
| 320 } | 322 } |
| 321 | 323 |
| 322 } // namespace ash | 324 } // namespace ash |
| OLD | NEW |