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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 : delegate_(NULL), | 55 : delegate_(NULL), |
56 candidate_window_controller_(NULL), | 56 candidate_window_controller_(NULL), |
57 xkeyboard_(NULL) { | 57 xkeyboard_(NULL) { |
58 } | 58 } |
59 virtual ~InputMethodManagerImplTest() {} | 59 virtual ~InputMethodManagerImplTest() {} |
60 | 60 |
61 virtual void SetUp() OVERRIDE { | 61 virtual void SetUp() OVERRIDE { |
62 delegate_ = new FakeInputMethodDelegate(); | 62 delegate_ = new FakeInputMethodDelegate(); |
63 manager_.reset(new InputMethodManagerImpl( | 63 manager_.reset(new InputMethodManagerImpl( |
64 scoped_ptr<InputMethodDelegate>(delegate_))); | 64 scoped_ptr<InputMethodDelegate>(delegate_))); |
| 65 manager_->GetInputMethodUtil()->UpdateHardwareLayoutCache(); |
65 candidate_window_controller_ = new MockCandidateWindowController; | 66 candidate_window_controller_ = new MockCandidateWindowController; |
66 manager_->SetCandidateWindowControllerForTesting( | 67 manager_->SetCandidateWindowControllerForTesting( |
67 candidate_window_controller_); | 68 candidate_window_controller_); |
68 xkeyboard_ = new MockXKeyboard; | 69 xkeyboard_ = new MockXKeyboard; |
69 manager_->SetXKeyboardForTesting(xkeyboard_); | 70 manager_->SetXKeyboardForTesting(xkeyboard_); |
70 mock_engine_handler_.reset(new MockIMEEngineHandler()); | 71 mock_engine_handler_.reset(new MockIMEEngineHandler()); |
71 IMEBridge::Initialize(); | 72 IMEBridge::Initialize(); |
72 IMEBridge::Get()->SetCurrentEngineHandler(mock_engine_handler_.get()); | 73 IMEBridge::Get()->SetCurrentEngineHandler(mock_engine_handler_.get()); |
73 | 74 |
74 ime_list_.clear(); | 75 ime_list_.clear(); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 candidate_window_controller_->NotifyCandidateWindowOpened(); | 227 candidate_window_controller_->NotifyCandidateWindowOpened(); |
227 EXPECT_EQ(2, observer.candidate_window_opened_count_); | 228 EXPECT_EQ(2, observer.candidate_window_opened_count_); |
228 candidate_window_controller_->NotifyCandidateWindowClosed(); | 229 candidate_window_controller_->NotifyCandidateWindowClosed(); |
229 EXPECT_EQ(2, observer.candidate_window_closed_count_); | 230 EXPECT_EQ(2, observer.candidate_window_closed_count_); |
230 manager_->RemoveCandidateWindowObserver(&observer); | 231 manager_->RemoveCandidateWindowObserver(&observer); |
231 } | 232 } |
232 | 233 |
233 TEST_F(InputMethodManagerImplTest, TestObserver) { | 234 TEST_F(InputMethodManagerImplTest, TestObserver) { |
234 // For http://crbug.com/19655#c11 - (3). browser_state_monitor_unittest.cc is | 235 // For http://crbug.com/19655#c11 - (3). browser_state_monitor_unittest.cc is |
235 // also for the scenario. | 236 // also for the scenario. |
| 237 std::vector<std::string> keyboard_layouts; |
| 238 keyboard_layouts.push_back("xkb:us::eng"); |
| 239 |
236 TestObserver observer; | 240 TestObserver observer; |
237 InitComponentExtension(); | 241 InitComponentExtension(); |
238 manager_->AddObserver(&observer); | 242 manager_->AddObserver(&observer); |
239 EXPECT_EQ(0, observer.input_method_changed_count_); | 243 EXPECT_EQ(0, observer.input_method_changed_count_); |
240 manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); | 244 manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
241 EXPECT_EQ(1, observer.input_method_changed_count_); | 245 EXPECT_EQ(1, observer.input_method_changed_count_); |
242 EXPECT_EQ(1, observer.input_method_property_changed_count_); | 246 EXPECT_EQ(1, observer.input_method_property_changed_count_); |
243 manager_->ChangeInputMethod("xkb:us:dvorak:eng"); | 247 manager_->ChangeInputMethod("xkb:us:dvorak:eng"); |
244 EXPECT_FALSE(observer.last_show_message_); | 248 EXPECT_FALSE(observer.last_show_message_); |
245 EXPECT_EQ(2, observer.input_method_changed_count_); | 249 EXPECT_EQ(2, observer.input_method_changed_count_); |
246 EXPECT_EQ(2, observer.input_method_property_changed_count_); | 250 EXPECT_EQ(2, observer.input_method_property_changed_count_); |
247 manager_->ChangeInputMethod("xkb:us:dvorak:eng"); | 251 manager_->ChangeInputMethod("xkb:us:dvorak:eng"); |
248 EXPECT_FALSE(observer.last_show_message_); | 252 EXPECT_FALSE(observer.last_show_message_); |
249 | 253 |
250 // The observer is always notified even when the same input method ID is | 254 // 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"); | 280 "xkb:us:dvorak:eng"); |
277 EXPECT_TRUE(Contain(*methods.get(), *id_to_find)); | 281 EXPECT_TRUE(Contain(*methods.get(), *id_to_find)); |
278 id_to_find = manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( | 282 id_to_find = manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( |
279 "xkb:fr::fra"); | 283 "xkb:fr::fra"); |
280 EXPECT_TRUE(Contain(*methods.get(), *id_to_find)); | 284 EXPECT_TRUE(Contain(*methods.get(), *id_to_find)); |
281 } | 285 } |
282 | 286 |
283 TEST_F(InputMethodManagerImplTest, TestEnableLayouts) { | 287 TEST_F(InputMethodManagerImplTest, TestEnableLayouts) { |
284 // Currently 5 keyboard layouts are supported for en-US, and 1 for ja. See | 288 // Currently 5 keyboard layouts are supported for en-US, and 1 for ja. See |
285 // ibus_input_method.txt. | 289 // ibus_input_method.txt. |
| 290 std::vector<std::string> keyboard_layouts; |
| 291 |
286 InitComponentExtension(); | 292 InitComponentExtension(); |
287 manager_->EnableLoginLayouts("en-US", ""); | 293 manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
288 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); | 294 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); |
289 for (size_t i = 0; i < manager_->GetActiveInputMethodIds().size(); ++i) | 295 for (size_t i = 0; i < manager_->GetActiveInputMethodIds().size(); ++i) |
290 LOG(ERROR) << manager_->GetActiveInputMethodIds().at(i); | 296 LOG(ERROR) << manager_->GetActiveInputMethodIds().at(i); |
291 | 297 |
292 // For http://crbug.com/19655#c11 - (5) | 298 // For http://crbug.com/19655#c11 - (5) |
293 // The hardware keyboard layout "xkb:us::eng" is always active, hence 2U. | 299 // The hardware keyboard layout "xkb:us::eng" is always active, hence 2U. |
294 manager_->EnableLoginLayouts("ja", ""); // Japanese | 300 manager_->EnableLoginLayouts("ja", keyboard_layouts); // Japanese |
295 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 301 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
296 } | 302 } |
297 | 303 |
298 TEST_F(InputMethodManagerImplTest, TestEnableLayoutsAndCurrentInputMethod) { | 304 TEST_F(InputMethodManagerImplTest, TestEnableLayoutsAndCurrentInputMethod) { |
299 // For http://crbug.com/329061 | 305 // For http://crbug.com/329061 |
300 manager_->EnableLoginLayouts("en-US", "xkb:se::swe"); | 306 std::vector<std::string> keyboard_layouts; |
| 307 keyboard_layouts.push_back("xkb:se::swe"); |
| 308 |
| 309 manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
301 const std::string im_id = manager_->GetCurrentInputMethod().id(); | 310 const std::string im_id = manager_->GetCurrentInputMethod().id(); |
302 EXPECT_EQ("xkb:se::swe", im_id); | 311 EXPECT_EQ("xkb:se::swe", im_id); |
303 } | 312 } |
304 | 313 |
305 TEST_F(InputMethodManagerImplTest, TestEnableLayoutsNonUsHardwareKeyboard) { | 314 TEST_F(InputMethodManagerImplTest, TestEnableLayoutsNonUsHardwareKeyboard) { |
306 // The physical layout is French. | 315 // The physical layout is French. |
307 delegate_->set_hardware_keyboard_layout("xkb:fr::fra"); | 316 manager_->GetInputMethodUtil()->SetHardwareKeyboardLayoutForTesting( |
308 manager_->EnableLoginLayouts("en-US", ""); | 317 "xkb:fr::fra"); |
| 318 manager_->EnableLoginLayouts( |
| 319 "en-US", |
| 320 manager_->GetInputMethodUtil()->GetHardwareLoginInputMethodIds()); |
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()->SetHardwareKeyboardLayoutForTesting( |
312 manager_->EnableLoginLayouts("ja", ""); | 324 "xkb:jp::jpn"); |
| 325 manager_->EnableLoginLayouts( |
| 326 "ja", |
| 327 manager_->GetInputMethodUtil()->GetHardwareLoginInputMethodIds()); |
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()->SetHardwareKeyboardLayoutForTesting( |
318 manager_->EnableLoginLayouts("ru", ""); | 333 "xkb:ru::rus"); |
| 334 manager_->EnableLoginLayouts( |
| 335 "ru", |
| 336 manager_->GetInputMethodUtil()->GetHardwareLoginInputMethodIds()); |
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 // The physical layouts are French and Hungarian. |
| 344 manager_->GetInputMethodUtil()->SetHardwareKeyboardLayoutForTesting( |
| 345 "xkb:fr::fra,xkb:hu::hun"); |
| 346 manager_->EnableLoginLayouts( |
| 347 "en-US", |
| 348 manager_->GetInputMethodUtil()->GetHardwareLoginInputMethodIds()); |
| 349 // 5 + French + Hungarian |
| 350 EXPECT_EQ(7U, manager_->GetNumActiveInputMethods()); |
| 351 } |
| 352 |
| 353 TEST_F(InputMethodManagerImplTest, |
| 354 TestEnableMultipleHardwareKeyboardLayout_NoLoginKeyboard) { |
| 355 // The physical layouts are English (US) and Russian. |
| 356 manager_->GetInputMethodUtil()->SetHardwareKeyboardLayoutForTesting( |
| 357 "xkb:us::eng,xkb:ru::rus"); |
| 358 manager_->EnableLoginLayouts( |
| 359 "ru", |
| 360 manager_->GetInputMethodUtil()->GetHardwareLoginInputMethodIds()); |
| 361 // xkb:us:eng |
| 362 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); |
| 363 } |
| 364 |
324 TEST_F(InputMethodManagerImplTest, TestActiveInputMethods) { | 365 TEST_F(InputMethodManagerImplTest, TestActiveInputMethods) { |
325 manager_->EnableLoginLayouts("ja", ""); // Japanese | 366 std::vector<std::string> keyboard_layouts; |
| 367 manager_->EnableLoginLayouts("ja", keyboard_layouts); // Japanese |
326 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 368 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
327 scoped_ptr<InputMethodDescriptors> methods( | 369 scoped_ptr<InputMethodDescriptors> methods( |
328 manager_->GetActiveInputMethods()); | 370 manager_->GetActiveInputMethods()); |
329 ASSERT_TRUE(methods.get()); | 371 ASSERT_TRUE(methods.get()); |
330 EXPECT_EQ(2U, methods->size()); | 372 EXPECT_EQ(2U, methods->size()); |
331 const InputMethodDescriptor* id_to_find = | 373 const InputMethodDescriptor* id_to_find = |
332 manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( | 374 manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( |
333 "xkb:us::eng"); | 375 "xkb:us::eng"); |
334 EXPECT_TRUE(Contain(*methods.get(), *id_to_find)); | 376 EXPECT_TRUE(Contain(*methods.get(), *id_to_find)); |
335 id_to_find = manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( | 377 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); | 711 manager_->SetCurrentInputMethodProperties(current_property_list); |
670 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); | 712 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); |
671 EXPECT_EQ("key-chewing", | 713 EXPECT_EQ("key-chewing", |
672 manager_->GetCurrentInputMethodProperties().at(0).key); | 714 manager_->GetCurrentInputMethodProperties().at(0).key); |
673 } | 715 } |
674 | 716 |
675 TEST_F(InputMethodManagerImplTest, TestNextInputMethod) { | 717 TEST_F(InputMethodManagerImplTest, TestNextInputMethod) { |
676 TestObserver observer; | 718 TestObserver observer; |
677 manager_->AddObserver(&observer); | 719 manager_->AddObserver(&observer); |
678 InitComponentExtension(); | 720 InitComponentExtension(); |
| 721 std::vector<std::string> keyboard_layouts; |
| 722 keyboard_layouts.push_back("xkb:us::eng"); |
679 // For http://crbug.com/19655#c11 - (1) | 723 // For http://crbug.com/19655#c11 - (1) |
680 manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); | 724 manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
681 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); | 725 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); |
682 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | 726 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
683 EXPECT_EQ("us", xkeyboard_->last_layout_); | 727 EXPECT_EQ("us", xkeyboard_->last_layout_); |
684 manager_->SwitchToNextInputMethod(); | 728 manager_->SwitchToNextInputMethod(); |
685 EXPECT_TRUE(observer.last_show_message_); | 729 EXPECT_TRUE(observer.last_show_message_); |
686 EXPECT_EQ("xkb:us:intl:eng", manager_->GetCurrentInputMethod().id()); | 730 EXPECT_EQ("xkb:us:intl:eng", manager_->GetCurrentInputMethod().id()); |
687 EXPECT_EQ("us(intl)", xkeyboard_->last_layout_); | 731 EXPECT_EQ("us(intl)", xkeyboard_->last_layout_); |
688 manager_->SwitchToNextInputMethod(); | 732 manager_->SwitchToNextInputMethod(); |
689 EXPECT_TRUE(observer.last_show_message_); | 733 EXPECT_TRUE(observer.last_show_message_); |
690 EXPECT_EQ("xkb:us:altgr-intl:eng", manager_->GetCurrentInputMethod().id()); | 734 EXPECT_EQ("xkb:us:altgr-intl:eng", manager_->GetCurrentInputMethod().id()); |
(...skipping 17 matching lines...) Expand all Loading... |
708 TEST_F(InputMethodManagerImplTest, TestPreviousInputMethod) { | 752 TEST_F(InputMethodManagerImplTest, TestPreviousInputMethod) { |
709 TestObserver observer; | 753 TestObserver observer; |
710 manager_->AddObserver(&observer); | 754 manager_->AddObserver(&observer); |
711 InitComponentExtension(); | 755 InitComponentExtension(); |
712 | 756 |
713 ui::Accelerator keydown_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); | 757 ui::Accelerator keydown_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); |
714 keydown_accelerator.set_type(ui::ET_KEY_PRESSED); | 758 keydown_accelerator.set_type(ui::ET_KEY_PRESSED); |
715 ui::Accelerator keyup_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); | 759 ui::Accelerator keyup_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); |
716 keyup_accelerator.set_type(ui::ET_KEY_RELEASED); | 760 keyup_accelerator.set_type(ui::ET_KEY_RELEASED); |
717 | 761 |
718 manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); | 762 std::vector<std::string> keyboard_layouts; |
| 763 keyboard_layouts.push_back("xkb:us::eng"); |
| 764 manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
719 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); | 765 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); |
720 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | 766 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
721 EXPECT_EQ("us", xkeyboard_->last_layout_); | 767 EXPECT_EQ("us", xkeyboard_->last_layout_); |
722 EXPECT_TRUE(manager_->SwitchToNextInputMethod()); | 768 EXPECT_TRUE(manager_->SwitchToNextInputMethod()); |
723 EXPECT_TRUE(observer.last_show_message_); | 769 EXPECT_TRUE(observer.last_show_message_); |
724 EXPECT_EQ("xkb:us:intl:eng", manager_->GetCurrentInputMethod().id()); | 770 EXPECT_EQ("xkb:us:intl:eng", manager_->GetCurrentInputMethod().id()); |
725 EXPECT_EQ("us(intl)", xkeyboard_->last_layout_); | 771 EXPECT_EQ("us(intl)", xkeyboard_->last_layout_); |
726 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keydown_accelerator)); | 772 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keydown_accelerator)); |
727 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keyup_accelerator)); | 773 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keyup_accelerator)); |
728 EXPECT_TRUE(observer.last_show_message_); | 774 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)); | 827 EXPECT_FALSE(manager_->SwitchToPreviousInputMethod(keydown_accelerator)); |
782 EXPECT_FALSE(manager_->SwitchToPreviousInputMethod(keyup_accelerator)); | 828 EXPECT_FALSE(manager_->SwitchToPreviousInputMethod(keyup_accelerator)); |
783 | 829 |
784 manager_->RemoveObserver(&observer); | 830 manager_->RemoveObserver(&observer); |
785 } | 831 } |
786 | 832 |
787 TEST_F(InputMethodManagerImplTest, TestSwitchInputMethodWithUsLayouts) { | 833 TEST_F(InputMethodManagerImplTest, TestSwitchInputMethodWithUsLayouts) { |
788 TestObserver observer; | 834 TestObserver observer; |
789 manager_->AddObserver(&observer); | 835 manager_->AddObserver(&observer); |
790 InitComponentExtension(); | 836 InitComponentExtension(); |
791 manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); | 837 std::vector<std::string> keyboard_layouts; |
| 838 keyboard_layouts.push_back("xkb:us::eng"); |
| 839 manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
792 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); | 840 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); |
793 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | 841 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
794 EXPECT_EQ("us", xkeyboard_->last_layout_); | 842 EXPECT_EQ("us", xkeyboard_->last_layout_); |
795 | 843 |
796 // Henkan, Muhenkan, ZenkakuHankaku should be ignored when no Japanese IMEs | 844 // Henkan, Muhenkan, ZenkakuHankaku should be ignored when no Japanese IMEs |
797 // and keyboards are enabled. | 845 // and keyboards are enabled. |
798 EXPECT_FALSE(manager_->SwitchInputMethod( | 846 EXPECT_FALSE(manager_->SwitchInputMethod( |
799 ui::Accelerator(ui::VKEY_CONVERT, ui::EF_NONE))); | 847 ui::Accelerator(ui::VKEY_CONVERT, ui::EF_NONE))); |
800 EXPECT_FALSE(observer.last_show_message_); | 848 EXPECT_FALSE(observer.last_show_message_); |
801 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | 849 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
(...skipping 16 matching lines...) Expand all Loading... |
818 | 866 |
819 TEST_F(InputMethodManagerImplTest, TestSwitchInputMethodWithJpLayout) { | 867 TEST_F(InputMethodManagerImplTest, TestSwitchInputMethodWithJpLayout) { |
820 // Enable "xkb:jp::jpn" and press Muhenkan/ZenkakuHankaku. | 868 // Enable "xkb:jp::jpn" and press Muhenkan/ZenkakuHankaku. |
821 InitComponentExtension(); | 869 InitComponentExtension(); |
822 | 870 |
823 ui::Accelerator keydown_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); | 871 ui::Accelerator keydown_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); |
824 keydown_accelerator.set_type(ui::ET_KEY_PRESSED); | 872 keydown_accelerator.set_type(ui::ET_KEY_PRESSED); |
825 ui::Accelerator keyup_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); | 873 ui::Accelerator keyup_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); |
826 keyup_accelerator.set_type(ui::ET_KEY_RELEASED); | 874 keyup_accelerator.set_type(ui::ET_KEY_RELEASED); |
827 | 875 |
828 manager_->EnableLoginLayouts("ja", "xkb:us::eng"); | 876 std::vector<std::string> keyboard_layouts; |
| 877 keyboard_layouts.push_back("xkb:us::eng"); |
| 878 manager_->EnableLoginLayouts("ja", keyboard_layouts); |
829 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 879 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
830 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | 880 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
831 EXPECT_EQ("us", xkeyboard_->last_layout_); | 881 EXPECT_EQ("us", xkeyboard_->last_layout_); |
832 EXPECT_TRUE(manager_->SwitchInputMethod( | 882 EXPECT_TRUE(manager_->SwitchInputMethod( |
833 ui::Accelerator(ui::VKEY_NONCONVERT, ui::EF_NONE))); | 883 ui::Accelerator(ui::VKEY_NONCONVERT, ui::EF_NONE))); |
834 EXPECT_EQ("xkb:jp::jpn", manager_->GetCurrentInputMethod().id()); | 884 EXPECT_EQ("xkb:jp::jpn", manager_->GetCurrentInputMethod().id()); |
835 EXPECT_EQ("jp", xkeyboard_->last_layout_); | 885 EXPECT_EQ("jp", xkeyboard_->last_layout_); |
836 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keydown_accelerator)); | 886 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keydown_accelerator)); |
837 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keyup_accelerator)); | 887 EXPECT_TRUE(manager_->SwitchToPreviousInputMethod(keyup_accelerator)); |
838 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | 888 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); | 1193 ids.push_back(ext_id2); |
1144 EXPECT_TRUE(manager_->EnableInputMethods(ids)); | 1194 EXPECT_TRUE(manager_->EnableInputMethods(ids)); |
1145 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 1195 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
1146 EXPECT_EQ(ext_id1, manager_->GetCurrentInputMethod().id()); | 1196 EXPECT_EQ(ext_id1, manager_->GetCurrentInputMethod().id()); |
1147 manager_->ChangeInputMethod(ext_id2); | 1197 manager_->ChangeInputMethod(ext_id2); |
1148 EXPECT_EQ(ext_id2, manager_->GetCurrentInputMethod().id()); | 1198 EXPECT_EQ(ext_id2, manager_->GetCurrentInputMethod().id()); |
1149 } | 1199 } |
1150 | 1200 |
1151 } // namespace input_method | 1201 } // namespace input_method |
1152 } // namespace chromeos | 1202 } // namespace chromeos |
OLD | NEW |