Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/input_method/input_method_manager_impl.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 candidate_window_controller_->NotifyCandidateWindowOpened(); | 226 candidate_window_controller_->NotifyCandidateWindowOpened(); |
| 227 EXPECT_EQ(2, observer.candidate_window_opened_count_); | 227 EXPECT_EQ(2, observer.candidate_window_opened_count_); |
| 228 candidate_window_controller_->NotifyCandidateWindowClosed(); | 228 candidate_window_controller_->NotifyCandidateWindowClosed(); |
| 229 EXPECT_EQ(2, observer.candidate_window_closed_count_); | 229 EXPECT_EQ(2, observer.candidate_window_closed_count_); |
| 230 manager_->RemoveCandidateWindowObserver(&observer); | 230 manager_->RemoveCandidateWindowObserver(&observer); |
| 231 } | 231 } |
| 232 | 232 |
| 233 TEST_F(InputMethodManagerImplTest, TestObserver) { | 233 TEST_F(InputMethodManagerImplTest, TestObserver) { |
| 234 // For http://crbug.com/19655#c11 - (3). browser_state_monitor_unittest.cc is | 234 // For http://crbug.com/19655#c11 - (3). browser_state_monitor_unittest.cc is |
| 235 // also for the scenario. | 235 // also for the scenario. |
| 236 std::vector<std::string> keyboard_layouts; | |
| 237 keyboard_layouts.push_back("xkb:us::eng"); | |
| 238 | |
| 236 TestObserver observer; | 239 TestObserver observer; |
| 237 InitComponentExtension(); | 240 InitComponentExtension(); |
| 238 manager_->AddObserver(&observer); | 241 manager_->AddObserver(&observer); |
| 239 EXPECT_EQ(0, observer.input_method_changed_count_); | 242 EXPECT_EQ(0, observer.input_method_changed_count_); |
| 240 manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); | 243 manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
| 241 EXPECT_EQ(1, observer.input_method_changed_count_); | 244 EXPECT_EQ(1, observer.input_method_changed_count_); |
| 242 EXPECT_EQ(1, observer.input_method_property_changed_count_); | 245 EXPECT_EQ(1, observer.input_method_property_changed_count_); |
| 243 manager_->ChangeInputMethod("xkb:us:dvorak:eng"); | 246 manager_->ChangeInputMethod("xkb:us:dvorak:eng"); |
| 244 EXPECT_FALSE(observer.last_show_message_); | 247 EXPECT_FALSE(observer.last_show_message_); |
| 245 EXPECT_EQ(2, observer.input_method_changed_count_); | 248 EXPECT_EQ(2, observer.input_method_changed_count_); |
| 246 EXPECT_EQ(2, observer.input_method_property_changed_count_); | 249 EXPECT_EQ(2, observer.input_method_property_changed_count_); |
| 247 manager_->ChangeInputMethod("xkb:us:dvorak:eng"); | 250 manager_->ChangeInputMethod("xkb:us:dvorak:eng"); |
| 248 EXPECT_FALSE(observer.last_show_message_); | 251 EXPECT_FALSE(observer.last_show_message_); |
| 249 | 252 |
| 250 // The observer is always notified even when the same input method ID is | 253 // The observer is always notified even when the same input method ID is |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 276 "xkb:us:dvorak:eng"); | 279 "xkb:us:dvorak:eng"); |
| 277 EXPECT_TRUE(Contain(*methods.get(), *id_to_find)); | 280 EXPECT_TRUE(Contain(*methods.get(), *id_to_find)); |
| 278 id_to_find = manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( | 281 id_to_find = manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( |
| 279 "xkb:fr::fra"); | 282 "xkb:fr::fra"); |
| 280 EXPECT_TRUE(Contain(*methods.get(), *id_to_find)); | 283 EXPECT_TRUE(Contain(*methods.get(), *id_to_find)); |
| 281 } | 284 } |
| 282 | 285 |
| 283 TEST_F(InputMethodManagerImplTest, TestEnableLayouts) { | 286 TEST_F(InputMethodManagerImplTest, TestEnableLayouts) { |
| 284 // Currently 5 keyboard layouts are supported for en-US, and 1 for ja. See | 287 // Currently 5 keyboard layouts are supported for en-US, and 1 for ja. See |
| 285 // ibus_input_method.txt. | 288 // ibus_input_method.txt. |
| 289 std::vector<std::string> keyboard_layouts; | |
| 290 | |
| 286 InitComponentExtension(); | 291 InitComponentExtension(); |
| 287 manager_->EnableLoginLayouts("en-US", ""); | 292 manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
| 288 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); | 293 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); |
| 289 for (size_t i = 0; i < manager_->GetActiveInputMethodIds().size(); ++i) | 294 for (size_t i = 0; i < manager_->GetActiveInputMethodIds().size(); ++i) |
| 290 LOG(ERROR) << manager_->GetActiveInputMethodIds().at(i); | 295 LOG(ERROR) << manager_->GetActiveInputMethodIds().at(i); |
| 291 | 296 |
| 292 // For http://crbug.com/19655#c11 - (5) | 297 // For http://crbug.com/19655#c11 - (5) |
| 293 // The hardware keyboard layout "xkb:us::eng" is always active, hence 2U. | 298 // The hardware keyboard layout "xkb:us::eng" is always active, hence 2U. |
| 294 manager_->EnableLoginLayouts("ja", ""); // Japanese | 299 manager_->EnableLoginLayouts("ja", keyboard_layouts); // Japanese |
| 295 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 300 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
| 296 } | 301 } |
| 297 | 302 |
| 298 TEST_F(InputMethodManagerImplTest, TestEnableLayoutsAndCurrentInputMethod) { | 303 TEST_F(InputMethodManagerImplTest, TestEnableLayoutsAndCurrentInputMethod) { |
| 299 // For http://crbug.com/329061 | 304 // For http://crbug.com/329061 |
| 300 manager_->EnableLoginLayouts("en-US", "xkb:se::swe"); | 305 std::vector<std::string> keyboard_layouts; |
| 306 keyboard_layouts.push_back("xkb:se::swe"); | |
| 307 | |
| 308 manager_->EnableLoginLayouts("en-US", keyboard_layouts); | |
| 301 const std::string im_id = manager_->GetCurrentInputMethod().id(); | 309 const std::string im_id = manager_->GetCurrentInputMethod().id(); |
| 302 EXPECT_EQ("xkb:se::swe", im_id); | 310 EXPECT_EQ("xkb:se::swe", im_id); |
| 303 } | 311 } |
| 304 | 312 |
| 305 TEST_F(InputMethodManagerImplTest, TestEnableLayoutsNonUsHardwareKeyboard) { | 313 TEST_F(InputMethodManagerImplTest, TestEnableLayoutsNonUsHardwareKeyboard) { |
| 314 std::vector<std::string> keyboard_layouts; | |
| 315 | |
| 306 // The physical layout is French. | 316 // The physical layout is French. |
| 307 delegate_->set_hardware_keyboard_layout("xkb:fr::fra"); | 317 keyboard_layouts.push_back("xkb:fr::fra"); |
| 308 manager_->EnableLoginLayouts("en-US", ""); | 318 delegate_->set_hardware_keyboard_layout(keyboard_layouts); |
| 319 keyboard_layouts.clear(); | |
| 320 manager_->EnableLoginLayouts("en-US", keyboard_layouts); | |
| 309 EXPECT_EQ(6U, manager_->GetNumActiveInputMethods()); // 5 + French | 321 EXPECT_EQ(6U, manager_->GetNumActiveInputMethods()); // 5 + French |
| 310 // The physical layout is Japanese. | 322 // The physical layout is Japanese. |
| 311 delegate_->set_hardware_keyboard_layout("xkb:jp::jpn"); | 323 manager_->GetInputMethodUtil()->InvalidateHardwareInputMethodIdsCache(); |
| 312 manager_->EnableLoginLayouts("ja", ""); | 324 keyboard_layouts.push_back("xkb:jp::jpn"); |
| 325 delegate_->set_hardware_keyboard_layout(keyboard_layouts); | |
|
Alexander Alekseev
2014/02/12 14:45:35
Why set_hardware_keyboard_layout() doesn't invalid
Seigo Nonaka
2014/02/12 16:49:51
To invalidate internal cache, need to include chro
Alexander Alekseev
2014/02/12 17:55:52
I mean you can replace two calls:
GetInputMethod
Seigo Nonaka
2014/02/13 04:36:05
Done.
| |
| 326 keyboard_layouts.clear(); | |
| 327 manager_->EnableLoginLayouts("ja", keyboard_layouts); | |
| 313 // "xkb:us::eng" is not needed, hence 1. | 328 // "xkb:us::eng" is not needed, hence 1. |
| 314 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); | 329 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); |
| 315 | 330 |
| 316 // The physical layout is Russian. | 331 // The physical layout is Russian. |
| 317 delegate_->set_hardware_keyboard_layout("xkb:ru::rus"); | 332 manager_->GetInputMethodUtil()->InvalidateHardwareInputMethodIdsCache(); |
| 318 manager_->EnableLoginLayouts("ru", ""); | 333 keyboard_layouts.push_back("xkb:ru::rus"); |
| 334 delegate_->set_hardware_keyboard_layout(keyboard_layouts); | |
| 335 keyboard_layouts.clear(); | |
| 336 manager_->EnableLoginLayouts("ru", keyboard_layouts); | |
| 319 // "xkb:us::eng" only. | 337 // "xkb:us::eng" only. |
| 320 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); | 338 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); |
| 321 EXPECT_EQ("xkb:us::eng", manager_->GetActiveInputMethodIds().front()); | 339 EXPECT_EQ("xkb:us::eng", manager_->GetActiveInputMethodIds().front()); |
| 322 } | 340 } |
| 323 | 341 |
| 342 TEST_F(InputMethodManagerImplTest, TestEnableMultipleHardwareKeyboardLayout) { | |
| 343 std::vector<std::string> keyboard_layouts; | |
| 344 | |
| 345 // The physical layouts are French and Hungarian. | |
| 346 keyboard_layouts.push_back("xkb:fr::fra"); | |
| 347 keyboard_layouts.push_back("xkb:hu::hun"); | |
| 348 delegate_->set_hardware_keyboard_layout(keyboard_layouts); | |
| 349 keyboard_layouts.clear(); | |
| 350 manager_->EnableLoginLayouts("en-US", keyboard_layouts); | |
| 351 // 5 + French + Hungarian | |
| 352 EXPECT_EQ(7U, manager_->GetNumActiveInputMethods()); | |
| 353 } | |
| 354 | |
| 355 TEST_F(InputMethodManagerImplTest, | |
| 356 TestEnableMultipleHardwareKeyboardLayout_NoLoginKeyboard) { | |
| 357 std::vector<std::string> keyboard_layouts; | |
| 358 | |
| 359 // The physical layouts are French and Hungarian. | |
|
Alexander Alekseev
2014/02/12 14:45:35
English (US) and Russian.
Seigo Nonaka
2014/02/12 16:49:51
Done.
| |
| 360 keyboard_layouts.push_back("xkb:us::eng"); | |
| 361 keyboard_layouts.push_back("xkb:ru::rus"); | |
| 362 delegate_->set_hardware_keyboard_layout(keyboard_layouts); | |
| 363 keyboard_layouts.clear(); | |
| 364 manager_->EnableLoginLayouts("ru", keyboard_layouts); | |
| 365 // xkb:us:eng | |
| 366 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); | |
| 367 } | |
| 368 | |
| 324 TEST_F(InputMethodManagerImplTest, TestActiveInputMethods) { | 369 TEST_F(InputMethodManagerImplTest, TestActiveInputMethods) { |
| 325 manager_->EnableLoginLayouts("ja", ""); // Japanese | 370 std::vector<std::string> keyboard_layouts; |
| 371 manager_->EnableLoginLayouts("ja", keyboard_layouts); // Japanese | |
| 326 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 372 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
| 327 scoped_ptr<InputMethodDescriptors> methods( | 373 scoped_ptr<InputMethodDescriptors> methods( |
| 328 manager_->GetActiveInputMethods()); | 374 manager_->GetActiveInputMethods()); |
| 329 ASSERT_TRUE(methods.get()); | 375 ASSERT_TRUE(methods.get()); |
| 330 EXPECT_EQ(2U, methods->size()); | 376 EXPECT_EQ(2U, methods->size()); |
| 331 const InputMethodDescriptor* id_to_find = | 377 const InputMethodDescriptor* id_to_find = |
| 332 manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( | 378 manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( |
| 333 "xkb:us::eng"); | 379 "xkb:us::eng"); |
| 334 EXPECT_TRUE(Contain(*methods.get(), *id_to_find)); | 380 EXPECT_TRUE(Contain(*methods.get(), *id_to_find)); |
| 335 id_to_find = manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( | 381 id_to_find = manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 669 manager_->SetCurrentInputMethodProperties(current_property_list); | 715 manager_->SetCurrentInputMethodProperties(current_property_list); |
| 670 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); | 716 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); |
| 671 EXPECT_EQ("key-chewing", | 717 EXPECT_EQ("key-chewing", |
| 672 manager_->GetCurrentInputMethodProperties().at(0).key); | 718 manager_->GetCurrentInputMethodProperties().at(0).key); |
| 673 } | 719 } |
| 674 | 720 |
| 675 TEST_F(InputMethodManagerImplTest, TestNextInputMethod) { | 721 TEST_F(InputMethodManagerImplTest, TestNextInputMethod) { |
| 676 TestObserver observer; | 722 TestObserver observer; |
| 677 manager_->AddObserver(&observer); | 723 manager_->AddObserver(&observer); |
| 678 InitComponentExtension(); | 724 InitComponentExtension(); |
| 725 std::vector<std::string> keyboard_layouts; | |
| 726 keyboard_layouts.push_back("xkb:us::eng"); | |
| 679 // For http://crbug.com/19655#c11 - (1) | 727 // For http://crbug.com/19655#c11 - (1) |
| 680 manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); | 728 manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
| 681 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); | 729 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); |
| 682 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | 730 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
| 683 EXPECT_EQ("us", xkeyboard_->last_layout_); | 731 EXPECT_EQ("us", xkeyboard_->last_layout_); |
| 684 manager_->SwitchToNextInputMethod(); | 732 manager_->SwitchToNextInputMethod(); |
| 685 EXPECT_TRUE(observer.last_show_message_); | 733 EXPECT_TRUE(observer.last_show_message_); |
| 686 EXPECT_EQ("xkb:us:intl:eng", manager_->GetCurrentInputMethod().id()); | 734 EXPECT_EQ("xkb:us:intl:eng", manager_->GetCurrentInputMethod().id()); |
| 687 EXPECT_EQ("us(intl)", xkeyboard_->last_layout_); | 735 EXPECT_EQ("us(intl)", xkeyboard_->last_layout_); |
| 688 manager_->SwitchToNextInputMethod(); | 736 manager_->SwitchToNextInputMethod(); |
| 689 EXPECT_TRUE(observer.last_show_message_); | 737 EXPECT_TRUE(observer.last_show_message_); |
| 690 EXPECT_EQ("xkb:us:altgr-intl:eng", manager_->GetCurrentInputMethod().id()); | 738 EXPECT_EQ("xkb:us:altgr-intl:eng", manager_->GetCurrentInputMethod().id()); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 708 TEST_F(InputMethodManagerImplTest, TestPreviousInputMethod) { | 756 TEST_F(InputMethodManagerImplTest, TestPreviousInputMethod) { |
| 709 TestObserver observer; | 757 TestObserver observer; |
| 710 manager_->AddObserver(&observer); | 758 manager_->AddObserver(&observer); |
| 711 InitComponentExtension(); | 759 InitComponentExtension(); |
| 712 | 760 |
| 713 ui::Accelerator keydown_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); | 761 ui::Accelerator keydown_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); |
| 714 keydown_accelerator.set_type(ui::ET_KEY_PRESSED); | 762 keydown_accelerator.set_type(ui::ET_KEY_PRESSED); |
| 715 ui::Accelerator keyup_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); | 763 ui::Accelerator keyup_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); |
| 716 keyup_accelerator.set_type(ui::ET_KEY_RELEASED); | 764 keyup_accelerator.set_type(ui::ET_KEY_RELEASED); |
| 717 | 765 |
| 718 manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); | 766 std::vector<std::string> keyboard_layouts; |
| 767 keyboard_layouts.push_back("xkb:us::eng"); | |
| 768 manager_->EnableLoginLayouts("en-US", keyboard_layouts); | |
| 719 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); | 769 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); |
| 720 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | 770 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
| 721 EXPECT_EQ("us", xkeyboard_->last_layout_); | 771 EXPECT_EQ("us", xkeyboard_->last_layout_); |
| 722 EXPECT_TRUE(manager_->SwitchToNextInputMethod()); | 772 EXPECT_TRUE(manager_->SwitchToNextInputMethod()); |
| 723 EXPECT_TRUE(observer.last_show_message_); | 773 EXPECT_TRUE(observer.last_show_message_); |
| 724 EXPECT_EQ("xkb:us:intl:eng", manager_->GetCurrentInputMethod().id()); | 774 EXPECT_EQ("xkb:us:intl:eng", manager_->GetCurrentInputMethod().id()); |
| 725 EXPECT_EQ("us(intl)", xkeyboard_->last_layout_); | 775 EXPECT_EQ("us(intl)", xkeyboard_->last_layout_); |
| 726 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keydown_accelerator)); | 776 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keydown_accelerator)); |
| 727 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keyup_accelerator)); | 777 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keyup_accelerator)); |
| 728 EXPECT_TRUE(observer.last_show_message_); | 778 EXPECT_TRUE(observer.last_show_message_); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 781 EXPECT_FALSE(manager_->SwitchToPreviousInputMethod(keydown_accelerator)); | 831 EXPECT_FALSE(manager_->SwitchToPreviousInputMethod(keydown_accelerator)); |
| 782 EXPECT_FALSE(manager_->SwitchToPreviousInputMethod(keyup_accelerator)); | 832 EXPECT_FALSE(manager_->SwitchToPreviousInputMethod(keyup_accelerator)); |
| 783 | 833 |
| 784 manager_->RemoveObserver(&observer); | 834 manager_->RemoveObserver(&observer); |
| 785 } | 835 } |
| 786 | 836 |
| 787 TEST_F(InputMethodManagerImplTest, TestSwitchInputMethodWithUsLayouts) { | 837 TEST_F(InputMethodManagerImplTest, TestSwitchInputMethodWithUsLayouts) { |
| 788 TestObserver observer; | 838 TestObserver observer; |
| 789 manager_->AddObserver(&observer); | 839 manager_->AddObserver(&observer); |
| 790 InitComponentExtension(); | 840 InitComponentExtension(); |
| 791 manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); | 841 std::vector<std::string> keyboard_layouts; |
| 842 keyboard_layouts.push_back("xkb:us::eng"); | |
| 843 manager_->EnableLoginLayouts("en-US", keyboard_layouts); | |
| 792 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); | 844 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); |
| 793 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | 845 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
| 794 EXPECT_EQ("us", xkeyboard_->last_layout_); | 846 EXPECT_EQ("us", xkeyboard_->last_layout_); |
| 795 | 847 |
| 796 // Henkan, Muhenkan, ZenkakuHankaku should be ignored when no Japanese IMEs | 848 // Henkan, Muhenkan, ZenkakuHankaku should be ignored when no Japanese IMEs |
| 797 // and keyboards are enabled. | 849 // and keyboards are enabled. |
| 798 EXPECT_FALSE(manager_->SwitchInputMethod( | 850 EXPECT_FALSE(manager_->SwitchInputMethod( |
| 799 ui::Accelerator(ui::VKEY_CONVERT, ui::EF_NONE))); | 851 ui::Accelerator(ui::VKEY_CONVERT, ui::EF_NONE))); |
| 800 EXPECT_FALSE(observer.last_show_message_); | 852 EXPECT_FALSE(observer.last_show_message_); |
| 801 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | 853 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 818 | 870 |
| 819 TEST_F(InputMethodManagerImplTest, TestSwitchInputMethodWithJpLayout) { | 871 TEST_F(InputMethodManagerImplTest, TestSwitchInputMethodWithJpLayout) { |
| 820 // Enable "xkb:jp::jpn" and press Muhenkan/ZenkakuHankaku. | 872 // Enable "xkb:jp::jpn" and press Muhenkan/ZenkakuHankaku. |
| 821 InitComponentExtension(); | 873 InitComponentExtension(); |
| 822 | 874 |
| 823 ui::Accelerator keydown_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); | 875 ui::Accelerator keydown_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); |
| 824 keydown_accelerator.set_type(ui::ET_KEY_PRESSED); | 876 keydown_accelerator.set_type(ui::ET_KEY_PRESSED); |
| 825 ui::Accelerator keyup_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); | 877 ui::Accelerator keyup_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); |
| 826 keyup_accelerator.set_type(ui::ET_KEY_RELEASED); | 878 keyup_accelerator.set_type(ui::ET_KEY_RELEASED); |
| 827 | 879 |
| 828 manager_->EnableLoginLayouts("ja", "xkb:us::eng"); | 880 std::vector<std::string> keyboard_layouts; |
| 881 keyboard_layouts.push_back("xkb:us::eng"); | |
| 882 manager_->EnableLoginLayouts("ja", keyboard_layouts); | |
| 829 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 883 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
| 830 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | 884 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
| 831 EXPECT_EQ("us", xkeyboard_->last_layout_); | 885 EXPECT_EQ("us", xkeyboard_->last_layout_); |
| 832 EXPECT_TRUE(manager_->SwitchInputMethod( | 886 EXPECT_TRUE(manager_->SwitchInputMethod( |
| 833 ui::Accelerator(ui::VKEY_NONCONVERT, ui::EF_NONE))); | 887 ui::Accelerator(ui::VKEY_NONCONVERT, ui::EF_NONE))); |
| 834 EXPECT_EQ("xkb:jp::jpn", manager_->GetCurrentInputMethod().id()); | 888 EXPECT_EQ("xkb:jp::jpn", manager_->GetCurrentInputMethod().id()); |
| 835 EXPECT_EQ("jp", xkeyboard_->last_layout_); | 889 EXPECT_EQ("jp", xkeyboard_->last_layout_); |
| 836 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keydown_accelerator)); | 890 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keydown_accelerator)); |
| 837 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keyup_accelerator)); | 891 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keyup_accelerator)); |
| 838 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | 892 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1143 ids.push_back(ext_id2); | 1197 ids.push_back(ext_id2); |
| 1144 EXPECT_TRUE(manager_->EnableInputMethods(ids)); | 1198 EXPECT_TRUE(manager_->EnableInputMethods(ids)); |
| 1145 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 1199 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
| 1146 EXPECT_EQ(ext_id1, manager_->GetCurrentInputMethod().id()); | 1200 EXPECT_EQ(ext_id1, manager_->GetCurrentInputMethod().id()); |
| 1147 manager_->ChangeInputMethod(ext_id2); | 1201 manager_->ChangeInputMethod(ext_id2); |
| 1148 EXPECT_EQ(ext_id2, manager_->GetCurrentInputMethod().id()); | 1202 EXPECT_EQ(ext_id2, manager_->GetCurrentInputMethod().id()); |
| 1149 } | 1203 } |
| 1150 | 1204 |
| 1151 } // namespace input_method | 1205 } // namespace input_method |
| 1152 } // namespace chromeos | 1206 } // namespace chromeos |
| OLD | NEW |