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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 EXPECT_TRUE(manager_->EnableInputMethods(ids)); | 782 EXPECT_TRUE(manager_->EnableInputMethods(ids)); |
783 EXPECT_EQ("xkb:kr:kr104:kor", manager_->GetCurrentInputMethod().id()); | 783 EXPECT_EQ("xkb:kr:kr104:kor", manager_->GetCurrentInputMethod().id()); |
784 EXPECT_TRUE(manager_->SwitchInputMethod( | 784 EXPECT_TRUE(manager_->SwitchInputMethod( |
785 ui::Accelerator(ui::VKEY_HANGUL, ui::EF_NONE))); | 785 ui::Accelerator(ui::VKEY_HANGUL, ui::EF_NONE))); |
786 EXPECT_EQ("mozc-hangul", manager_->GetCurrentInputMethod().id()); | 786 EXPECT_EQ("mozc-hangul", manager_->GetCurrentInputMethod().id()); |
787 EXPECT_TRUE(manager_->SwitchInputMethod( | 787 EXPECT_TRUE(manager_->SwitchInputMethod( |
788 ui::Accelerator(ui::VKEY_HANGUL, ui::EF_NONE))); | 788 ui::Accelerator(ui::VKEY_HANGUL, ui::EF_NONE))); |
789 EXPECT_EQ("xkb:kr:kr104:kor", manager_->GetCurrentInputMethod().id()); | 789 EXPECT_EQ("xkb:kr:kr104:kor", manager_->GetCurrentInputMethod().id()); |
790 } | 790 } |
791 | 791 |
792 TEST_F(InputMethodManagerImplTest, TestEnableDisableHotkeys) { | |
793 manager_->EnableLayouts("ja", "xkb:us::eng"); | |
794 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | |
795 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | |
796 manager_->DisableHotkeys(); | |
797 EXPECT_FALSE(manager_->SwitchToNextInputMethod()); | |
798 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | |
799 EXPECT_FALSE(manager_->SwitchToPreviousInputMethod()); | |
800 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | |
801 EXPECT_FALSE(manager_->SwitchInputMethod( | |
802 ui::Accelerator(ui::VKEY_NONCONVERT, ui::EF_NONE))); | |
803 EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | |
804 manager_->EnableHotkeys(); | |
805 EXPECT_TRUE(manager_->SwitchToNextInputMethod()); | |
806 EXPECT_NE("xkb:us::eng", manager_->GetCurrentInputMethod().id()); | |
807 } | |
808 | |
809 TEST_F(InputMethodManagerImplTest, TestAddRemoveExtensionInputMethods) { | 792 TEST_F(InputMethodManagerImplTest, TestAddRemoveExtensionInputMethods) { |
810 TestObserver observer; | 793 TestObserver observer; |
811 manager_->AddObserver(&observer); | 794 manager_->AddObserver(&observer); |
812 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 795 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); |
813 std::vector<std::string> ids; | 796 std::vector<std::string> ids; |
814 ids.push_back("xkb:us:dvorak:eng"); | 797 ids.push_back("xkb:us:dvorak:eng"); |
815 EXPECT_TRUE(manager_->EnableInputMethods(ids)); | 798 EXPECT_TRUE(manager_->EnableInputMethods(ids)); |
816 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); | 799 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); |
817 EXPECT_EQ(0, controller_->start_count_); | 800 EXPECT_EQ(0, controller_->start_count_); |
818 EXPECT_EQ(1, observer.input_method_changed_count_); | 801 EXPECT_EQ(1, observer.input_method_changed_count_); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 910 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
928 EXPECT_EQ(1, controller_->reset_count_); | 911 EXPECT_EQ(1, controller_->reset_count_); |
929 manager_->ChangeInputMethod("mozc"); | 912 manager_->ChangeInputMethod("mozc"); |
930 EXPECT_EQ(1, controller_->reset_count_); | 913 EXPECT_EQ(1, controller_->reset_count_); |
931 manager_->ChangeInputMethod("xkb:us::eng"); | 914 manager_->ChangeInputMethod("xkb:us::eng"); |
932 EXPECT_EQ(2, controller_->reset_count_); | 915 EXPECT_EQ(2, controller_->reset_count_); |
933 } | 916 } |
934 | 917 |
935 } // namespace input_method | 918 } // namespace input_method |
936 } // namespace chromeos | 919 } // namespace chromeos |
OLD | NEW |