| 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 "ash/ime/input_method_menu_item.h" |
| 10 #include "ash/ime/input_method_menu_manager.h" |
| 9 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 12 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 12 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 13 #include "base/logging.h" | 15 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 16 #include "chrome/browser/chromeos/input_method/input_method_engine_interface.h" | 18 #include "chrome/browser/chromeos/input_method/input_method_engine_interface.h" |
| 17 #include "chrome/browser/chromeos/input_method/mock_candidate_window_controller.
h" | 19 #include "chrome/browser/chromeos/input_method/mock_candidate_window_controller.
h" |
| 18 #include "chrome/browser/chromeos/input_method/mock_input_method_engine.h" | 20 #include "chrome/browser/chromeos/input_method/mock_input_method_engine.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 manager_->GetInputMethodUtil()->UpdateHardwareLayoutCache(); | 67 manager_->GetInputMethodUtil()->UpdateHardwareLayoutCache(); |
| 66 candidate_window_controller_ = new MockCandidateWindowController; | 68 candidate_window_controller_ = new MockCandidateWindowController; |
| 67 manager_->SetCandidateWindowControllerForTesting( | 69 manager_->SetCandidateWindowControllerForTesting( |
| 68 candidate_window_controller_); | 70 candidate_window_controller_); |
| 69 xkeyboard_ = new FakeXKeyboard; | 71 xkeyboard_ = new FakeXKeyboard; |
| 70 manager_->SetXKeyboardForTesting(xkeyboard_); | 72 manager_->SetXKeyboardForTesting(xkeyboard_); |
| 71 mock_engine_handler_.reset(new MockIMEEngineHandler()); | 73 mock_engine_handler_.reset(new MockIMEEngineHandler()); |
| 72 IMEBridge::Initialize(); | 74 IMEBridge::Initialize(); |
| 73 IMEBridge::Get()->SetCurrentEngineHandler(mock_engine_handler_.get()); | 75 IMEBridge::Get()->SetCurrentEngineHandler(mock_engine_handler_.get()); |
| 74 | 76 |
| 77 menu_manager_ = ash::ime::InputMethodMenuManager::GetInstance(); |
| 78 |
| 75 ime_list_.clear(); | 79 ime_list_.clear(); |
| 76 | 80 |
| 77 ComponentExtensionIME ext1; | 81 ComponentExtensionIME ext1; |
| 78 ext1.id = "fpfbhcjppmaeaijcidgiibchfbnhbelj"; | 82 ext1.id = "fpfbhcjppmaeaijcidgiibchfbnhbelj"; |
| 79 ext1.description = "ext1_description"; | 83 ext1.description = "ext1_description"; |
| 80 ext1.path = base::FilePath("ext1_file_path"); | 84 ext1.path = base::FilePath("ext1_file_path"); |
| 81 | 85 |
| 82 ComponentExtensionEngine ext1_engine1; | 86 ComponentExtensionEngine ext1_engine1; |
| 83 ext1_engine1.engine_id = "nacl_mozc_us"; | 87 ext1_engine1.engine_id = "nacl_mozc_us"; |
| 84 ext1_engine1.display_name = "ext1_engine_1_display_name"; | 88 ext1_engine1.display_name = "ext1_engine_1_display_name"; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 115 ext2.engines.push_back(ext2_engine2); | 119 ext2.engines.push_back(ext2_engine2); |
| 116 | 120 |
| 117 ime_list_.push_back(ext2); | 121 ime_list_.push_back(ext2); |
| 118 } | 122 } |
| 119 | 123 |
| 120 virtual void TearDown() OVERRIDE { | 124 virtual void TearDown() OVERRIDE { |
| 121 delegate_ = NULL; | 125 delegate_ = NULL; |
| 122 candidate_window_controller_ = NULL; | 126 candidate_window_controller_ = NULL; |
| 123 xkeyboard_ = NULL; | 127 xkeyboard_ = NULL; |
| 124 manager_.reset(); | 128 manager_.reset(); |
| 129 |
| 125 IMEBridge::Get()->SetCurrentEngineHandler(NULL); | 130 IMEBridge::Get()->SetCurrentEngineHandler(NULL); |
| 126 IMEBridge::Shutdown(); | 131 IMEBridge::Shutdown(); |
| 127 } | 132 } |
| 128 | 133 |
| 129 protected: | 134 protected: |
| 130 // Helper function to initialize component extension stuff for testing. | 135 // Helper function to initialize component extension stuff for testing. |
| 131 void InitComponentExtension() { | 136 void InitComponentExtension() { |
| 132 mock_delegate_ = new MockComponentExtIMEManagerDelegate(); | 137 mock_delegate_ = new MockComponentExtIMEManagerDelegate(); |
| 133 mock_delegate_->set_ime_list(ime_list_); | 138 mock_delegate_->set_ime_list(ime_list_); |
| 134 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate(mock_delegate_); | 139 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate(mock_delegate_); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 147 } | 152 } |
| 148 | 153 |
| 149 scoped_ptr<InputMethodManagerImpl> manager_; | 154 scoped_ptr<InputMethodManagerImpl> manager_; |
| 150 FakeInputMethodDelegate* delegate_; | 155 FakeInputMethodDelegate* delegate_; |
| 151 MockCandidateWindowController* candidate_window_controller_; | 156 MockCandidateWindowController* candidate_window_controller_; |
| 152 scoped_ptr<MockIMEEngineHandler> mock_engine_handler_; | 157 scoped_ptr<MockIMEEngineHandler> mock_engine_handler_; |
| 153 FakeXKeyboard* xkeyboard_; | 158 FakeXKeyboard* xkeyboard_; |
| 154 base::MessageLoop message_loop_; | 159 base::MessageLoop message_loop_; |
| 155 MockComponentExtIMEManagerDelegate* mock_delegate_; | 160 MockComponentExtIMEManagerDelegate* mock_delegate_; |
| 156 std::vector<ComponentExtensionIME> ime_list_; | 161 std::vector<ComponentExtensionIME> ime_list_; |
| 162 ash::ime::InputMethodMenuManager* menu_manager_; |
| 157 | 163 |
| 158 private: | 164 private: |
| 159 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImplTest); | 165 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImplTest); |
| 160 }; | 166 }; |
| 161 | 167 |
| 162 class TestObserver : public InputMethodManager::Observer { | 168 class TestObserver : public InputMethodManager::Observer, |
| 169 public ash::ime::InputMethodMenuManager::Observer{ |
| 163 public: | 170 public: |
| 164 TestObserver() | 171 TestObserver() |
| 165 : input_method_changed_count_(0), | 172 : input_method_changed_count_(0), |
| 166 input_method_property_changed_count_(0), | 173 input_method_menu_item_changed_count_(0), |
| 167 last_show_message_(false) { | 174 last_show_message_(false) { |
| 168 } | 175 } |
| 169 virtual ~TestObserver() {} | 176 virtual ~TestObserver() {} |
| 170 | 177 |
| 171 virtual void InputMethodChanged(InputMethodManager* manager, | 178 virtual void InputMethodChanged(InputMethodManager* manager, |
| 172 bool show_message) OVERRIDE { | 179 bool show_message) OVERRIDE { |
| 173 ++input_method_changed_count_; | 180 ++input_method_changed_count_; |
| 174 last_show_message_ = show_message; | 181 last_show_message_ = show_message; |
| 175 } | 182 } |
| 176 virtual void InputMethodPropertyChanged( | 183 virtual void InputMethodMenuItemChanged( |
| 177 InputMethodManager* manager) OVERRIDE { | 184 ash::ime::InputMethodMenuManager* manager) OVERRIDE { |
| 178 ++input_method_property_changed_count_; | 185 ++input_method_menu_item_changed_count_; |
| 179 } | 186 } |
| 180 | 187 |
| 181 int input_method_changed_count_; | 188 int input_method_changed_count_; |
| 182 int input_method_property_changed_count_; | 189 int input_method_menu_item_changed_count_; |
| 183 bool last_show_message_; | 190 bool last_show_message_; |
| 184 | 191 |
| 185 private: | 192 private: |
| 186 DISALLOW_COPY_AND_ASSIGN(TestObserver); | 193 DISALLOW_COPY_AND_ASSIGN(TestObserver); |
| 187 }; | 194 }; |
| 188 | 195 |
| 189 class TestCandidateWindowObserver | 196 class TestCandidateWindowObserver |
| 190 : public InputMethodManager::CandidateWindowObserver { | 197 : public InputMethodManager::CandidateWindowObserver { |
| 191 public: | 198 public: |
| 192 TestCandidateWindowObserver() | 199 TestCandidateWindowObserver() |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 240 |
| 234 TEST_F(InputMethodManagerImplTest, TestObserver) { | 241 TEST_F(InputMethodManagerImplTest, TestObserver) { |
| 235 // For http://crbug.com/19655#c11 - (3). browser_state_monitor_unittest.cc is | 242 // For http://crbug.com/19655#c11 - (3). browser_state_monitor_unittest.cc is |
| 236 // also for the scenario. | 243 // also for the scenario. |
| 237 std::vector<std::string> keyboard_layouts; | 244 std::vector<std::string> keyboard_layouts; |
| 238 keyboard_layouts.push_back("xkb:us::eng"); | 245 keyboard_layouts.push_back("xkb:us::eng"); |
| 239 | 246 |
| 240 TestObserver observer; | 247 TestObserver observer; |
| 241 InitComponentExtension(); | 248 InitComponentExtension(); |
| 242 manager_->AddObserver(&observer); | 249 manager_->AddObserver(&observer); |
| 250 menu_manager_->AddObserver(&observer); |
| 243 EXPECT_EQ(0, observer.input_method_changed_count_); | 251 EXPECT_EQ(0, observer.input_method_changed_count_); |
| 244 manager_->EnableLoginLayouts("en-US", keyboard_layouts); | 252 manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
| 245 EXPECT_EQ(1, observer.input_method_changed_count_); | 253 EXPECT_EQ(1, observer.input_method_changed_count_); |
| 246 EXPECT_EQ(1, observer.input_method_property_changed_count_); | 254 EXPECT_EQ(1, observer.input_method_menu_item_changed_count_); |
| 247 manager_->ChangeInputMethod("xkb:us:dvorak:eng"); | 255 manager_->ChangeInputMethod("xkb:us:dvorak:eng"); |
| 248 EXPECT_FALSE(observer.last_show_message_); | 256 EXPECT_FALSE(observer.last_show_message_); |
| 249 EXPECT_EQ(2, observer.input_method_changed_count_); | 257 EXPECT_EQ(2, observer.input_method_changed_count_); |
| 250 EXPECT_EQ(2, observer.input_method_property_changed_count_); | 258 EXPECT_EQ(2, observer.input_method_menu_item_changed_count_); |
| 251 manager_->ChangeInputMethod("xkb:us:dvorak:eng"); | 259 manager_->ChangeInputMethod("xkb:us:dvorak:eng"); |
| 252 EXPECT_FALSE(observer.last_show_message_); | 260 EXPECT_FALSE(observer.last_show_message_); |
| 253 | 261 |
| 254 // The observer is always notified even when the same input method ID is | 262 // The observer is always notified even when the same input method ID is |
| 255 // passed to ChangeInputMethod() more than twice. | 263 // passed to ChangeInputMethod() more than twice. |
| 256 // TODO(komatsu): Revisit if this is neccessary. | 264 // TODO(komatsu): Revisit if this is neccessary. |
| 257 EXPECT_EQ(3, observer.input_method_changed_count_); | 265 EXPECT_EQ(3, observer.input_method_changed_count_); |
| 258 | 266 |
| 259 // If the same input method ID is passed, PropertyChanged() is not | 267 // If the same input method ID is passed, PropertyChanged() is not |
| 260 // notified. | 268 // notified. |
| 261 EXPECT_EQ(2, observer.input_method_property_changed_count_); | 269 EXPECT_EQ(2, observer.input_method_menu_item_changed_count_); |
| 262 | 270 |
| 263 manager_->RemoveObserver(&observer); | 271 manager_->RemoveObserver(&observer); |
| 272 menu_manager_->RemoveObserver(&observer); |
| 264 } | 273 } |
| 265 | 274 |
| 266 TEST_F(InputMethodManagerImplTest, TestGetSupportedInputMethods) { | 275 TEST_F(InputMethodManagerImplTest, TestGetSupportedInputMethods) { |
| 267 InitComponentExtension(); | 276 InitComponentExtension(); |
| 268 scoped_ptr<InputMethodDescriptors> methods( | 277 scoped_ptr<InputMethodDescriptors> methods( |
| 269 manager_->GetSupportedInputMethods()); | 278 manager_->GetSupportedInputMethods()); |
| 270 ASSERT_TRUE(methods.get()); | 279 ASSERT_TRUE(methods.get()); |
| 271 // Try to find random 4-5 layuts and IMEs to make sure the returned list is | 280 // Try to find random 4-5 layuts and IMEs to make sure the returned list is |
| 272 // correct. | 281 // correct. |
| 273 const InputMethodDescriptor* id_to_find = | 282 const InputMethodDescriptor* id_to_find = |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 EXPECT_EQ(5, xkeyboard_->set_current_keyboard_layout_by_name_count_); | 637 EXPECT_EQ(5, xkeyboard_->set_current_keyboard_layout_by_name_count_); |
| 629 EXPECT_EQ("us(dvorak)", xkeyboard_->last_layout_); | 638 EXPECT_EQ("us(dvorak)", xkeyboard_->last_layout_); |
| 630 // Disable Dvorak. | 639 // Disable Dvorak. |
| 631 ids.erase(ids.begin()); | 640 ids.erase(ids.begin()); |
| 632 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 641 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
| 633 EXPECT_EQ(3U, manager_->GetNumActiveInputMethods()); | 642 EXPECT_EQ(3U, manager_->GetNumActiveInputMethods()); |
| 634 EXPECT_EQ(6, xkeyboard_->set_current_keyboard_layout_by_name_count_); | 643 EXPECT_EQ(6, xkeyboard_->set_current_keyboard_layout_by_name_count_); |
| 635 EXPECT_EQ("us(colemak)", xkeyboard_->last_layout_); | 644 EXPECT_EQ("us(colemak)", xkeyboard_->last_layout_); |
| 636 } | 645 } |
| 637 | 646 |
| 638 TEST_F(InputMethodManagerImplTest, TestActivateInputMethodProperty) { | 647 TEST_F(InputMethodManagerImplTest, TestActivateInputMethodMenuItem) { |
| 639 const std::string kKey = "key"; | 648 const std::string kKey = "key"; |
| 640 InputMethodPropertyList property_list; | 649 ash::ime::InputMethodMenuItemList menu_list; |
| 641 property_list.push_back(InputMethodProperty(kKey, "label", false, false)); | 650 menu_list.push_back(ash::ime::InputMethodMenuItem( |
| 642 manager_->SetCurrentInputMethodProperties(property_list); | 651 kKey, "label", false, false)); |
| 652 menu_manager_->SetCurrentInputMethodMenuItemList(menu_list); |
| 643 | 653 |
| 644 manager_->ActivateInputMethodProperty(kKey); | 654 manager_->ActivateInputMethodMenuItem(kKey); |
| 645 EXPECT_EQ(kKey, mock_engine_handler_->last_activated_property()); | 655 EXPECT_EQ(kKey, mock_engine_handler_->last_activated_property()); |
| 646 | 656 |
| 647 // Key2 is not registered, so activated property should not be changed. | 657 // Key2 is not registered, so activated property should not be changed. |
| 648 manager_->ActivateInputMethodProperty("key2"); | 658 manager_->ActivateInputMethodMenuItem("key2"); |
| 649 EXPECT_EQ(kKey, mock_engine_handler_->last_activated_property()); | 659 EXPECT_EQ(kKey, mock_engine_handler_->last_activated_property()); |
| 650 } | 660 } |
| 651 | 661 |
| 652 TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodProperties) { | 662 TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodProperties) { |
| 653 InitComponentExtension(); | 663 InitComponentExtension(); |
| 654 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 664 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
| 655 | 665 |
| 656 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 666 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); |
| 657 std::vector<std::string> ids; | 667 std::vector<std::string> ids; |
| 658 ids.push_back("xkb:us::eng"); | 668 ids.push_back("xkb:us::eng"); |
| 659 ids.push_back(kNaclMozcUsId); | 669 ids.push_back(kNaclMozcUsId); |
| 660 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 670 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
| 661 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 671 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
| 662 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 672 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
| 663 manager_->ChangeInputMethod(kNaclMozcUsId); | 673 manager_->ChangeInputMethod(kNaclMozcUsId); |
| 664 | 674 |
| 665 InputMethodPropertyList current_property_list; | 675 ash::ime::InputMethodMenuItemList current_property_list; |
| 666 current_property_list.push_back(InputMethodProperty("key", | 676 current_property_list.push_back(ash::ime::InputMethodMenuItem( |
| 667 "label", | 677 "key", "label", false, false)); |
| 668 false, | 678 menu_manager_->SetCurrentInputMethodMenuItemList(current_property_list); |
| 669 false)); | |
| 670 manager_->SetCurrentInputMethodProperties(current_property_list); | |
| 671 | 679 |
| 672 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); | 680 ASSERT_EQ(1U, menu_manager_->GetCurrentInputMethodMenuItemList().size()); |
| 673 EXPECT_EQ("key", manager_->GetCurrentInputMethodProperties().at(0).key); | 681 EXPECT_EQ("key", |
| 682 menu_manager_->GetCurrentInputMethodMenuItemList().at(0).key); |
| 674 | 683 |
| 675 manager_->ChangeInputMethod("xkb:us::eng"); | 684 manager_->ChangeInputMethod("xkb:us::eng"); |
| 676 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 685 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
| 677 } | 686 } |
| 678 | 687 |
| 679 TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodPropertiesTwoImes) { | 688 TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodPropertiesTwoImes) { |
| 680 InitComponentExtension(); | 689 InitComponentExtension(); |
| 681 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 690 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
| 682 | 691 |
| 683 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 692 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); |
| 684 std::vector<std::string> ids; | 693 std::vector<std::string> ids; |
| 685 ids.push_back(kNaclMozcUsId); // Japanese | 694 ids.push_back(kNaclMozcUsId); // Japanese |
| 686 ids.push_back(kExt2Engine1Id); // T-Chinese | 695 ids.push_back(kExt2Engine1Id); // T-Chinese |
| 687 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 696 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
| 688 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 697 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
| 689 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 698 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
| 690 | 699 |
| 691 InputMethodPropertyList current_property_list; | 700 ash::ime::InputMethodMenuItemList current_property_list; |
| 692 current_property_list.push_back(InputMethodProperty("key-mozc", | 701 current_property_list.push_back(ash::ime::InputMethodMenuItem("key-mozc", |
| 693 "label", | 702 "label", |
| 694 false, | 703 false, |
| 695 false)); | 704 false)); |
| 696 manager_->SetCurrentInputMethodProperties(current_property_list); | 705 menu_manager_->SetCurrentInputMethodMenuItemList(current_property_list); |
| 697 | 706 |
| 698 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); | 707 ASSERT_EQ(1U, menu_manager_->GetCurrentInputMethodMenuItemList().size()); |
| 699 EXPECT_EQ("key-mozc", manager_->GetCurrentInputMethodProperties().at(0).key); | 708 EXPECT_EQ("key-mozc", |
| 709 menu_manager_->GetCurrentInputMethodMenuItemList().at(0).key); |
| 700 | 710 |
| 701 manager_->ChangeInputMethod(kExt2Engine1Id); | 711 manager_->ChangeInputMethod(kExt2Engine1Id); |
| 702 // Since the IME is changed, the property for mozc Japanese should be hidden. | 712 // Since the IME is changed, the property for mozc Japanese should be hidden. |
| 703 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 713 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
| 704 | 714 |
| 705 // Asynchronous property update signal from mozc-chewing. | 715 // Asynchronous property update signal from mozc-chewing. |
| 706 current_property_list.clear(); | 716 current_property_list.clear(); |
| 707 current_property_list.push_back(InputMethodProperty("key-chewing", | 717 current_property_list.push_back(ash::ime::InputMethodMenuItem( |
| 708 "label", | 718 "key-chewing", "label", false, false)); |
| 709 false, | 719 menu_manager_->SetCurrentInputMethodMenuItemList(current_property_list); |
| 710 false)); | 720 ASSERT_EQ(1U, menu_manager_->GetCurrentInputMethodMenuItemList().size()); |
| 711 manager_->SetCurrentInputMethodProperties(current_property_list); | |
| 712 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); | |
| 713 EXPECT_EQ("key-chewing", | 721 EXPECT_EQ("key-chewing", |
| 714 manager_->GetCurrentInputMethodProperties().at(0).key); | 722 menu_manager_->GetCurrentInputMethodMenuItemList().at(0).key); |
| 715 } | 723 } |
| 716 | 724 |
| 717 TEST_F(InputMethodManagerImplTest, TestNextInputMethod) { | 725 TEST_F(InputMethodManagerImplTest, TestNextInputMethod) { |
| 718 TestObserver observer; | 726 TestObserver observer; |
| 719 manager_->AddObserver(&observer); | 727 manager_->AddObserver(&observer); |
| 720 InitComponentExtension(); | 728 InitComponentExtension(); |
| 721 std::vector<std::string> keyboard_layouts; | 729 std::vector<std::string> keyboard_layouts; |
| 722 keyboard_layouts.push_back("xkb:us::eng"); | 730 keyboard_layouts.push_back("xkb:us::eng"); |
| 723 // For http://crbug.com/19655#c11 - (1) | 731 // For http://crbug.com/19655#c11 - (1) |
| 724 manager_->EnableLoginLayouts("en-US", keyboard_layouts); | 732 manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 ids.push_back(ext_id2); | 1204 ids.push_back(ext_id2); |
| 1197 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 1205 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
| 1198 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 1206 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
| 1199 EXPECT_EQ(ext_id1, manager_->GetCurrentInputMethod().id()); | 1207 EXPECT_EQ(ext_id1, manager_->GetCurrentInputMethod().id()); |
| 1200 manager_->ChangeInputMethod(ext_id2); | 1208 manager_->ChangeInputMethod(ext_id2); |
| 1201 EXPECT_EQ(ext_id2, manager_->GetCurrentInputMethod().id()); | 1209 EXPECT_EQ(ext_id2, manager_->GetCurrentInputMethod().id()); |
| 1202 } | 1210 } |
| 1203 | 1211 |
| 1204 } // namespace input_method | 1212 } // namespace input_method |
| 1205 } // namespace chromeos | 1213 } // namespace chromeos |
| OLD | NEW |