| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 scoped_ptr<InputMethodDelegate>(delegate_))); | 66 scoped_ptr<InputMethodDelegate>(delegate_))); |
| 65 candidate_window_controller_ = new MockCandidateWindowController; | 67 candidate_window_controller_ = new MockCandidateWindowController; |
| 66 manager_->SetCandidateWindowControllerForTesting( | 68 manager_->SetCandidateWindowControllerForTesting( |
| 67 candidate_window_controller_); | 69 candidate_window_controller_); |
| 68 xkeyboard_ = new MockXKeyboard; | 70 xkeyboard_ = new MockXKeyboard; |
| 69 manager_->SetXKeyboardForTesting(xkeyboard_); | 71 manager_->SetXKeyboardForTesting(xkeyboard_); |
| 70 mock_engine_handler_.reset(new MockIMEEngineHandler()); | 72 mock_engine_handler_.reset(new MockIMEEngineHandler()); |
| 71 IMEBridge::Initialize(); | 73 IMEBridge::Initialize(); |
| 72 IMEBridge::Get()->SetCurrentEngineHandler(mock_engine_handler_.get()); | 74 IMEBridge::Get()->SetCurrentEngineHandler(mock_engine_handler_.get()); |
| 73 | 75 |
| 76 menu_manager_ = ash::ime::InputMethodMenuManager::Get(); |
| 77 |
| 74 ime_list_.clear(); | 78 ime_list_.clear(); |
| 75 | 79 |
| 76 ComponentExtensionIME ext1; | 80 ComponentExtensionIME ext1; |
| 77 ext1.id = "fpfbhcjppmaeaijcidgiibchfbnhbelj"; | 81 ext1.id = "fpfbhcjppmaeaijcidgiibchfbnhbelj"; |
| 78 ext1.description = "ext1_description"; | 82 ext1.description = "ext1_description"; |
| 79 ext1.path = base::FilePath("ext1_file_path"); | 83 ext1.path = base::FilePath("ext1_file_path"); |
| 80 | 84 |
| 81 ComponentExtensionEngine ext1_engine1; | 85 ComponentExtensionEngine ext1_engine1; |
| 82 ext1_engine1.engine_id = "nacl_mozc_us"; | 86 ext1_engine1.engine_id = "nacl_mozc_us"; |
| 83 ext1_engine1.display_name = "ext1_engine_1_display_name"; | 87 ext1_engine1.display_name = "ext1_engine_1_display_name"; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 114 ext2.engines.push_back(ext2_engine2); | 118 ext2.engines.push_back(ext2_engine2); |
| 115 | 119 |
| 116 ime_list_.push_back(ext2); | 120 ime_list_.push_back(ext2); |
| 117 } | 121 } |
| 118 | 122 |
| 119 virtual void TearDown() OVERRIDE { | 123 virtual void TearDown() OVERRIDE { |
| 120 delegate_ = NULL; | 124 delegate_ = NULL; |
| 121 candidate_window_controller_ = NULL; | 125 candidate_window_controller_ = NULL; |
| 122 xkeyboard_ = NULL; | 126 xkeyboard_ = NULL; |
| 123 manager_.reset(); | 127 manager_.reset(); |
| 128 |
| 124 IMEBridge::Get()->SetCurrentEngineHandler(NULL); | 129 IMEBridge::Get()->SetCurrentEngineHandler(NULL); |
| 125 IMEBridge::Shutdown(); | 130 IMEBridge::Shutdown(); |
| 126 } | 131 } |
| 127 | 132 |
| 128 protected: | 133 protected: |
| 129 // Helper function to initialize component extension stuff for testing. | 134 // Helper function to initialize component extension stuff for testing. |
| 130 void InitComponentExtension() { | 135 void InitComponentExtension() { |
| 131 mock_delegate_ = new MockComponentExtIMEManagerDelegate(); | 136 mock_delegate_ = new MockComponentExtIMEManagerDelegate(); |
| 132 mock_delegate_->set_ime_list(ime_list_); | 137 mock_delegate_->set_ime_list(ime_list_); |
| 133 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate(mock_delegate_); | 138 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate(mock_delegate_); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 146 } | 151 } |
| 147 | 152 |
| 148 scoped_ptr<InputMethodManagerImpl> manager_; | 153 scoped_ptr<InputMethodManagerImpl> manager_; |
| 149 FakeInputMethodDelegate* delegate_; | 154 FakeInputMethodDelegate* delegate_; |
| 150 MockCandidateWindowController* candidate_window_controller_; | 155 MockCandidateWindowController* candidate_window_controller_; |
| 151 scoped_ptr<MockIMEEngineHandler> mock_engine_handler_; | 156 scoped_ptr<MockIMEEngineHandler> mock_engine_handler_; |
| 152 MockXKeyboard* xkeyboard_; | 157 MockXKeyboard* xkeyboard_; |
| 153 base::MessageLoop message_loop_; | 158 base::MessageLoop message_loop_; |
| 154 MockComponentExtIMEManagerDelegate* mock_delegate_; | 159 MockComponentExtIMEManagerDelegate* mock_delegate_; |
| 155 std::vector<ComponentExtensionIME> ime_list_; | 160 std::vector<ComponentExtensionIME> ime_list_; |
| 161 ash::ime::InputMethodMenuManager* menu_manager_; |
| 156 | 162 |
| 157 private: | 163 private: |
| 158 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImplTest); | 164 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImplTest); |
| 159 }; | 165 }; |
| 160 | 166 |
| 161 class TestObserver : public InputMethodManager::Observer { | 167 class TestObserver : public InputMethodManager::Observer, |
| 168 public ash::ime::InputMethodMenuManager::Observer{ |
| 162 public: | 169 public: |
| 163 TestObserver() | 170 TestObserver() |
| 164 : input_method_changed_count_(0), | 171 : input_method_changed_count_(0), |
| 165 input_method_property_changed_count_(0), | 172 input_method_menu_item_changed_count_(0), |
| 166 last_show_message_(false) { | 173 last_show_message_(false) { |
| 167 } | 174 } |
| 168 virtual ~TestObserver() {} | 175 virtual ~TestObserver() {} |
| 169 | 176 |
| 170 virtual void InputMethodChanged(InputMethodManager* manager, | 177 virtual void InputMethodChanged(InputMethodManager* manager, |
| 171 bool show_message) OVERRIDE { | 178 bool show_message) OVERRIDE { |
| 172 ++input_method_changed_count_; | 179 ++input_method_changed_count_; |
| 173 last_show_message_ = show_message; | 180 last_show_message_ = show_message; |
| 174 } | 181 } |
| 175 virtual void InputMethodPropertyChanged( | 182 virtual void InputMethodMenuItemChanged( |
| 176 InputMethodManager* manager) OVERRIDE { | 183 ash::ime::InputMethodMenuManager* manager) OVERRIDE { |
| 177 ++input_method_property_changed_count_; | 184 ++input_method_menu_item_changed_count_; |
| 178 } | 185 } |
| 179 | 186 |
| 180 int input_method_changed_count_; | 187 int input_method_changed_count_; |
| 181 int input_method_property_changed_count_; | 188 int input_method_menu_item_changed_count_; |
| 182 bool last_show_message_; | 189 bool last_show_message_; |
| 183 | 190 |
| 184 private: | 191 private: |
| 185 DISALLOW_COPY_AND_ASSIGN(TestObserver); | 192 DISALLOW_COPY_AND_ASSIGN(TestObserver); |
| 186 }; | 193 }; |
| 187 | 194 |
| 188 class TestCandidateWindowObserver | 195 class TestCandidateWindowObserver |
| 189 : public InputMethodManager::CandidateWindowObserver { | 196 : public InputMethodManager::CandidateWindowObserver { |
| 190 public: | 197 public: |
| 191 TestCandidateWindowObserver() | 198 TestCandidateWindowObserver() |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 EXPECT_EQ(2, observer.candidate_window_closed_count_); | 236 EXPECT_EQ(2, observer.candidate_window_closed_count_); |
| 230 manager_->RemoveCandidateWindowObserver(&observer); | 237 manager_->RemoveCandidateWindowObserver(&observer); |
| 231 } | 238 } |
| 232 | 239 |
| 233 TEST_F(InputMethodManagerImplTest, TestObserver) { | 240 TEST_F(InputMethodManagerImplTest, TestObserver) { |
| 234 // For http://crbug.com/19655#c11 - (3). browser_state_monitor_unittest.cc is | 241 // For http://crbug.com/19655#c11 - (3). browser_state_monitor_unittest.cc is |
| 235 // also for the scenario. | 242 // also for the scenario. |
| 236 TestObserver observer; | 243 TestObserver observer; |
| 237 InitComponentExtension(); | 244 InitComponentExtension(); |
| 238 manager_->AddObserver(&observer); | 245 manager_->AddObserver(&observer); |
| 246 menu_manager_->AddObserver(&observer); |
| 239 EXPECT_EQ(0, observer.input_method_changed_count_); | 247 EXPECT_EQ(0, observer.input_method_changed_count_); |
| 240 manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); | 248 manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); |
| 241 EXPECT_EQ(1, observer.input_method_changed_count_); | 249 EXPECT_EQ(1, observer.input_method_changed_count_); |
| 242 EXPECT_EQ(1, observer.input_method_property_changed_count_); | 250 EXPECT_EQ(1, observer.input_method_menu_item_changed_count_); |
| 243 manager_->ChangeInputMethod("xkb:us:dvorak:eng"); | 251 manager_->ChangeInputMethod("xkb:us:dvorak:eng"); |
| 244 EXPECT_FALSE(observer.last_show_message_); | 252 EXPECT_FALSE(observer.last_show_message_); |
| 245 EXPECT_EQ(2, observer.input_method_changed_count_); | 253 EXPECT_EQ(2, observer.input_method_changed_count_); |
| 246 EXPECT_EQ(2, observer.input_method_property_changed_count_); | 254 EXPECT_EQ(2, 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 | 257 |
| 250 // The observer is always notified even when the same input method ID is | 258 // The observer is always notified even when the same input method ID is |
| 251 // passed to ChangeInputMethod() more than twice. | 259 // passed to ChangeInputMethod() more than twice. |
| 252 // TODO(komatsu): Revisit if this is neccessary. | 260 // TODO(komatsu): Revisit if this is neccessary. |
| 253 EXPECT_EQ(3, observer.input_method_changed_count_); | 261 EXPECT_EQ(3, observer.input_method_changed_count_); |
| 254 | 262 |
| 255 // If the same input method ID is passed, PropertyChanged() is not | 263 // If the same input method ID is passed, PropertyChanged() is not |
| 256 // notified. | 264 // notified. |
| 257 EXPECT_EQ(2, observer.input_method_property_changed_count_); | 265 EXPECT_EQ(2, observer.input_method_menu_item_changed_count_); |
| 258 | 266 |
| 259 manager_->RemoveObserver(&observer); | 267 manager_->RemoveObserver(&observer); |
| 260 } | 268 } |
| 261 | 269 |
| 262 TEST_F(InputMethodManagerImplTest, TestGetSupportedInputMethods) { | 270 TEST_F(InputMethodManagerImplTest, TestGetSupportedInputMethods) { |
| 263 InitComponentExtension(); | 271 InitComponentExtension(); |
| 264 scoped_ptr<InputMethodDescriptors> methods( | 272 scoped_ptr<InputMethodDescriptors> methods( |
| 265 manager_->GetSupportedInputMethods()); | 273 manager_->GetSupportedInputMethods()); |
| 266 ASSERT_TRUE(methods.get()); | 274 ASSERT_TRUE(methods.get()); |
| 267 // Try to find random 4-5 layuts and IMEs to make sure the returned list is | 275 // Try to find random 4-5 layuts and IMEs to make sure the returned list is |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 EXPECT_EQ(5, xkeyboard_->set_current_keyboard_layout_by_name_count_); | 594 EXPECT_EQ(5, xkeyboard_->set_current_keyboard_layout_by_name_count_); |
| 587 EXPECT_EQ("us(dvorak)", xkeyboard_->last_layout_); | 595 EXPECT_EQ("us(dvorak)", xkeyboard_->last_layout_); |
| 588 // Disable Dvorak. | 596 // Disable Dvorak. |
| 589 ids.erase(ids.begin()); | 597 ids.erase(ids.begin()); |
| 590 EXPECT_TRUE(manager_->EnableInputMethods(ids)); | 598 EXPECT_TRUE(manager_->EnableInputMethods(ids)); |
| 591 EXPECT_EQ(3U, manager_->GetNumActiveInputMethods()); | 599 EXPECT_EQ(3U, manager_->GetNumActiveInputMethods()); |
| 592 EXPECT_EQ(6, xkeyboard_->set_current_keyboard_layout_by_name_count_); | 600 EXPECT_EQ(6, xkeyboard_->set_current_keyboard_layout_by_name_count_); |
| 593 EXPECT_EQ("us(colemak)", xkeyboard_->last_layout_); | 601 EXPECT_EQ("us(colemak)", xkeyboard_->last_layout_); |
| 594 } | 602 } |
| 595 | 603 |
| 596 TEST_F(InputMethodManagerImplTest, TestActivateInputMethodProperty) { | 604 TEST_F(InputMethodManagerImplTest, TestActivateInputMethodMenuItem) { |
| 597 const std::string kKey = "key"; | 605 const std::string kKey = "key"; |
| 598 InputMethodPropertyList property_list; | 606 ash::ime::InputMethodMenuItemList menu_list; |
| 599 property_list.push_back(InputMethodProperty(kKey, "label", false, false)); | 607 menu_list.push_back(ash::ime::InputMethodMenuItem( |
| 600 manager_->SetCurrentInputMethodProperties(property_list); | 608 kKey, "label", false, false)); |
| 609 menu_manager_->SetCurrentInputMethodMenuItemList(menu_list); |
| 601 | 610 |
| 602 manager_->ActivateInputMethodProperty(kKey); | 611 manager_->ActivateInputMethodMenuItem(kKey); |
| 603 EXPECT_EQ(kKey, mock_engine_handler_->last_activated_property()); | 612 EXPECT_EQ(kKey, mock_engine_handler_->last_activated_property()); |
| 604 | 613 |
| 605 // Key2 is not registered, so activated property should not be changed. | 614 // Key2 is not registered, so activated property should not be changed. |
| 606 manager_->ActivateInputMethodProperty("key2"); | 615 manager_->ActivateInputMethodMenuItem("key2"); |
| 607 EXPECT_EQ(kKey, mock_engine_handler_->last_activated_property()); | 616 EXPECT_EQ(kKey, mock_engine_handler_->last_activated_property()); |
| 608 } | 617 } |
| 609 | 618 |
| 610 TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodProperties) { | 619 TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodProperties) { |
| 611 InitComponentExtension(); | 620 InitComponentExtension(); |
| 612 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 621 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
| 613 | 622 |
| 614 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 623 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); |
| 615 std::vector<std::string> ids; | 624 std::vector<std::string> ids; |
| 616 ids.push_back("xkb:us::eng"); | 625 ids.push_back("xkb:us::eng"); |
| 617 ids.push_back(kNaclMozcUsId); | 626 ids.push_back(kNaclMozcUsId); |
| 618 EXPECT_TRUE(manager_->EnableInputMethods(ids)); | 627 EXPECT_TRUE(manager_->EnableInputMethods(ids)); |
| 619 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 628 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
| 620 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 629 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
| 621 manager_->ChangeInputMethod(kNaclMozcUsId); | 630 manager_->ChangeInputMethod(kNaclMozcUsId); |
| 622 | 631 |
| 623 InputMethodPropertyList current_property_list; | 632 ash::ime::InputMethodMenuItemList current_property_list; |
| 624 current_property_list.push_back(InputMethodProperty("key", | 633 current_property_list.push_back(ash::ime::InputMethodMenuItem( |
| 625 "label", | 634 "key", "label", false, false)); |
| 626 false, | 635 menu_manager_->SetCurrentInputMethodMenuItemList(current_property_list); |
| 627 false)); | |
| 628 manager_->SetCurrentInputMethodProperties(current_property_list); | |
| 629 | 636 |
| 630 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); | 637 ASSERT_EQ(1U, menu_manager_->GetCurrentInputMethodMenuItemList().size()); |
| 631 EXPECT_EQ("key", manager_->GetCurrentInputMethodProperties().at(0).key); | 638 EXPECT_EQ("key", |
| 639 menu_manager_->GetCurrentInputMethodMenuItemList().at(0).key); |
| 632 | 640 |
| 633 manager_->ChangeInputMethod("xkb:us::eng"); | 641 manager_->ChangeInputMethod("xkb:us::eng"); |
| 634 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 642 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
| 635 } | 643 } |
| 636 | 644 |
| 637 TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodPropertiesTwoImes) { | 645 TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodPropertiesTwoImes) { |
| 638 InitComponentExtension(); | 646 InitComponentExtension(); |
| 639 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 647 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
| 640 | 648 |
| 641 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 649 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); |
| 642 std::vector<std::string> ids; | 650 std::vector<std::string> ids; |
| 643 ids.push_back(kNaclMozcUsId); // Japanese | 651 ids.push_back(kNaclMozcUsId); // Japanese |
| 644 ids.push_back(kExt2Engine1Id); // T-Chinese | 652 ids.push_back(kExt2Engine1Id); // T-Chinese |
| 645 EXPECT_TRUE(manager_->EnableInputMethods(ids)); | 653 EXPECT_TRUE(manager_->EnableInputMethods(ids)); |
| 646 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 654 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
| 647 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 655 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
| 648 | 656 |
| 649 InputMethodPropertyList current_property_list; | 657 ash::ime::InputMethodMenuItemList current_property_list; |
| 650 current_property_list.push_back(InputMethodProperty("key-mozc", | 658 current_property_list.push_back(ash::ime::InputMethodMenuItem("key-mozc", |
| 651 "label", | 659 "label", |
| 652 false, | 660 false, |
| 653 false)); | 661 false)); |
| 654 manager_->SetCurrentInputMethodProperties(current_property_list); | 662 menu_manager_->SetCurrentInputMethodMenuItemList(current_property_list); |
| 655 | 663 |
| 656 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); | 664 ASSERT_EQ(1U, menu_manager_->GetCurrentInputMethodMenuItemList().size()); |
| 657 EXPECT_EQ("key-mozc", manager_->GetCurrentInputMethodProperties().at(0).key); | 665 EXPECT_EQ("key-mozc", |
| 666 menu_manager_->GetCurrentInputMethodMenuItemList().at(0).key); |
| 658 | 667 |
| 659 manager_->ChangeInputMethod(kExt2Engine1Id); | 668 manager_->ChangeInputMethod(kExt2Engine1Id); |
| 660 // Since the IME is changed, the property for mozc Japanese should be hidden. | 669 // Since the IME is changed, the property for mozc Japanese should be hidden. |
| 661 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 670 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
| 662 | 671 |
| 663 // Asynchronous property update signal from mozc-chewing. | 672 // Asynchronous property update signal from mozc-chewing. |
| 664 current_property_list.clear(); | 673 current_property_list.clear(); |
| 665 current_property_list.push_back(InputMethodProperty("key-chewing", | 674 current_property_list.push_back(ash::ime::InputMethodMenuItem( |
| 666 "label", | 675 "key-chewing", "label", false, false)); |
| 667 false, | 676 menu_manager_->SetCurrentInputMethodMenuItemList(current_property_list); |
| 668 false)); | 677 ASSERT_EQ(1U, menu_manager_->GetCurrentInputMethodMenuItemList().size()); |
| 669 manager_->SetCurrentInputMethodProperties(current_property_list); | |
| 670 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); | |
| 671 EXPECT_EQ("key-chewing", | 678 EXPECT_EQ("key-chewing", |
| 672 manager_->GetCurrentInputMethodProperties().at(0).key); | 679 menu_manager_->GetCurrentInputMethodMenuItemList().at(0).key); |
| 673 } | 680 } |
| 674 | 681 |
| 675 TEST_F(InputMethodManagerImplTest, TestNextInputMethod) { | 682 TEST_F(InputMethodManagerImplTest, TestNextInputMethod) { |
| 676 TestObserver observer; | 683 TestObserver observer; |
| 677 manager_->AddObserver(&observer); | 684 manager_->AddObserver(&observer); |
| 678 InitComponentExtension(); | 685 InitComponentExtension(); |
| 679 // For http://crbug.com/19655#c11 - (1) | 686 // For http://crbug.com/19655#c11 - (1) |
| 680 manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); | 687 manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); |
| 681 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); | 688 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); |
| 682 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | 689 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 ids.push_back(ext_id2); | 1153 ids.push_back(ext_id2); |
| 1147 EXPECT_TRUE(manager_->EnableInputMethods(ids)); | 1154 EXPECT_TRUE(manager_->EnableInputMethods(ids)); |
| 1148 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 1155 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
| 1149 EXPECT_EQ(ext_id1, manager_->GetCurrentInputMethod().id()); | 1156 EXPECT_EQ(ext_id1, manager_->GetCurrentInputMethod().id()); |
| 1150 manager_->ChangeInputMethod(ext_id2); | 1157 manager_->ChangeInputMethod(ext_id2); |
| 1151 EXPECT_EQ(ext_id2, manager_->GetCurrentInputMethod().id()); | 1158 EXPECT_EQ(ext_id2, manager_->GetCurrentInputMethod().id()); |
| 1152 } | 1159 } |
| 1153 | 1160 |
| 1154 } // namespace input_method | 1161 } // namespace input_method |
| 1155 } // namespace chromeos | 1162 } // namespace chromeos |
| OLD | NEW |