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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 EXPECT_EQ(ids[0], | 802 EXPECT_EQ(ids[0], |
803 manager_->GetCurrentInputMethod().id()); | 803 manager_->GetCurrentInputMethod().id()); |
804 | 804 |
805 // Add two Extension IMEs. | 805 // Add two Extension IMEs. |
806 std::vector<std::string> layouts; | 806 std::vector<std::string> layouts; |
807 layouts.push_back("us"); | 807 layouts.push_back("us"); |
808 manager_->AddInputMethodExtension( | 808 manager_->AddInputMethodExtension( |
809 std::string(kExtensionImePrefix) + "deadbeef", | 809 std::string(kExtensionImePrefix) + "deadbeef", |
810 "deadbeef input method", | 810 "deadbeef input method", |
811 layouts, | 811 layouts, |
812 "en-US"); | 812 "en-US", |
| 813 NULL); |
813 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 814 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
814 EXPECT_EQ(1, controller_->start_count_); // should be started. | 815 EXPECT_EQ(1, controller_->start_count_); // should be started. |
815 { | 816 { |
816 scoped_ptr<InputMethodDescriptors> methods( | 817 scoped_ptr<InputMethodDescriptors> methods( |
817 manager_->GetActiveInputMethods()); | 818 manager_->GetActiveInputMethods()); |
818 ASSERT_EQ(2U, methods->size()); | 819 ASSERT_EQ(2U, methods->size()); |
819 EXPECT_EQ(std::string(kExtensionImePrefix) + "deadbeef", | 820 EXPECT_EQ(std::string(kExtensionImePrefix) + "deadbeef", |
820 // Ext IMEs should be at the end of the list. | 821 // Ext IMEs should be at the end of the list. |
821 methods->at(1).id()); | 822 methods->at(1).id()); |
822 } | 823 } |
823 manager_->AddInputMethodExtension( | 824 manager_->AddInputMethodExtension( |
824 std::string(kExtensionImePrefix) + "cafebabe", | 825 std::string(kExtensionImePrefix) + "cafebabe", |
825 "cafebabe input method", | 826 "cafebabe input method", |
826 layouts, | 827 layouts, |
827 "en-US"); | 828 "en-US", |
| 829 NULL); |
828 EXPECT_EQ(3U, manager_->GetNumActiveInputMethods()); | 830 EXPECT_EQ(3U, manager_->GetNumActiveInputMethods()); |
829 { | 831 { |
830 scoped_ptr<InputMethodDescriptors> methods( | 832 scoped_ptr<InputMethodDescriptors> methods( |
831 manager_->GetActiveInputMethods()); | 833 manager_->GetActiveInputMethods()); |
832 ASSERT_EQ(3U, methods->size()); | 834 ASSERT_EQ(3U, methods->size()); |
833 EXPECT_EQ(std::string(kExtensionImePrefix) + "deadbeef", | 835 EXPECT_EQ(std::string(kExtensionImePrefix) + "deadbeef", |
834 // Ext IMEs should be at the end of the list. | 836 // Ext IMEs should be at the end of the list. |
835 methods->at(1).id()); | 837 methods->at(1).id()); |
836 } | 838 } |
837 | 839 |
(...skipping 22 matching lines...) Expand all Loading... |
860 EXPECT_EQ(1, observer.input_method_changed_count_); | 862 EXPECT_EQ(1, observer.input_method_changed_count_); |
861 EXPECT_EQ(ids[0], manager_->GetCurrentInputMethod().id()); | 863 EXPECT_EQ(ids[0], manager_->GetCurrentInputMethod().id()); |
862 | 864 |
863 // Add an Extension IME. | 865 // Add an Extension IME. |
864 std::vector<std::string> layouts; | 866 std::vector<std::string> layouts; |
865 layouts.push_back("us"); | 867 layouts.push_back("us"); |
866 manager_->AddInputMethodExtension( | 868 manager_->AddInputMethodExtension( |
867 std::string(kExtensionImePrefix) + "deadbeef", | 869 std::string(kExtensionImePrefix) + "deadbeef", |
868 "deadbeef input method", | 870 "deadbeef input method", |
869 layouts, | 871 layouts, |
870 "en-US"); | 872 "en-US", |
| 873 NULL); |
871 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 874 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
872 EXPECT_EQ(1, observer.input_method_changed_count_); | 875 EXPECT_EQ(1, observer.input_method_changed_count_); |
873 | 876 |
874 // Switch to the IME. | 877 // Switch to the IME. |
875 manager_->SwitchToNextInputMethod(); | 878 manager_->SwitchToNextInputMethod(); |
876 EXPECT_EQ(2, observer.input_method_changed_count_); | 879 EXPECT_EQ(2, observer.input_method_changed_count_); |
877 EXPECT_EQ(std::string(kExtensionImePrefix) + "deadbeef", | 880 EXPECT_EQ(std::string(kExtensionImePrefix) + "deadbeef", |
878 manager_->GetCurrentInputMethod().id()); | 881 manager_->GetCurrentInputMethod().id()); |
879 | 882 |
880 // Lock the screen. This is for crosbug.com/27049. | 883 // Lock the screen. This is for crosbug.com/27049. |
(...skipping 29 matching lines...) Expand all Loading... |
910 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 913 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
911 EXPECT_EQ(1, controller_->reset_count_); | 914 EXPECT_EQ(1, controller_->reset_count_); |
912 manager_->ChangeInputMethod("mozc"); | 915 manager_->ChangeInputMethod("mozc"); |
913 EXPECT_EQ(1, controller_->reset_count_); | 916 EXPECT_EQ(1, controller_->reset_count_); |
914 manager_->ChangeInputMethod("xkb:us::eng"); | 917 manager_->ChangeInputMethod("xkb:us::eng"); |
915 EXPECT_EQ(2, controller_->reset_count_); | 918 EXPECT_EQ(2, controller_->reset_count_); |
916 } | 919 } |
917 | 920 |
918 } // namespace input_method | 921 } // namespace input_method |
919 } // namespace chromeos | 922 } // namespace chromeos |
OLD | NEW |