Chromium Code Reviews| Index: chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc |
| diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc |
| index 705fa01f36cf456ec6b9c9525fecc8a2fd71ae96..aedcf713f249dcf0cf5d592d27775eec78c71de9 100644 |
| --- a/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc |
| +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc |
| @@ -31,6 +31,15 @@ namespace chromeos { |
| namespace input_method { |
| namespace { |
| +bool IsContained(const InputMethodDescriptors& descriptors, |
|
satorux1
2013/04/19 03:54:17
function comment is missing. Besides, IsContained(
Seigo Nonaka
2013/04/20 04:50:31
Done.
|
| + const InputMethodDescriptor& target) { |
| + for (size_t i = 0; i < descriptors.size(); ++i) { |
| + if (descriptors[i].id() == target.id()) |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| class InputMethodManagerImplTest : public testing::Test { |
| public: |
| InputMethodManagerImplTest() |
| @@ -244,22 +253,18 @@ TEST_F(InputMethodManagerImplTest, TestGetSupportedInputMethods) { |
| // correct. |
| const InputMethodDescriptor* id_to_find = |
| manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId("mozc"); |
| - EXPECT_NE(methods->end(), |
| - std::find(methods->begin(), methods->end(), *id_to_find)); |
| id_to_find = manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( |
| "mozc-chewing"); |
| + EXPECT_TRUE(IsContained(*methods.get(), *id_to_find)); |
| id_to_find = manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( |
| "xkb:us::eng"); |
| - EXPECT_NE(methods->end(), |
| - std::find(methods->begin(), methods->end(), *id_to_find)); |
| + EXPECT_TRUE(IsContained(*methods.get(), *id_to_find)); |
| id_to_find = manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( |
| "xkb:us:dvorak:eng"); |
| - EXPECT_NE(methods->end(), |
| - std::find(methods->begin(), methods->end(), *id_to_find)); |
| + EXPECT_TRUE(IsContained(*methods.get(), *id_to_find)); |
| id_to_find = manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( |
| "xkb:fr::fra"); |
| - EXPECT_NE(methods->end(), |
| - std::find(methods->begin(), methods->end(), *id_to_find)); |
| + EXPECT_TRUE(IsContained(*methods.get(), *id_to_find)); |
| } |
| TEST_F(InputMethodManagerImplTest, TestEnableLayouts) { |
| @@ -275,8 +280,7 @@ TEST_F(InputMethodManagerImplTest, TestEnableLayouts) { |
| const InputMethodDescriptor* id_to_find = |
| manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( |
| "english-m"); // The "English Mystery" IME. |
| - EXPECT_EQ(methods->end(), |
| - std::find(methods->begin(), methods->end(), *id_to_find)); |
| + EXPECT_FALSE(IsContained(*methods.get(), *id_to_find)); |
| } |
| // For http://crbug.com/19655#c11 - (2) |
| EXPECT_EQ(0, mock_ibus_daemon_controller_->start_count()); |
| @@ -310,12 +314,10 @@ TEST_F(InputMethodManagerImplTest, TestActiveInputMethods) { |
| const InputMethodDescriptor* id_to_find = |
| manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( |
| "xkb:us::eng"); |
| - EXPECT_NE(methods->end(), |
| - std::find(methods->begin(), methods->end(), *id_to_find)); |
| + EXPECT_TRUE(IsContained(*methods.get(), *id_to_find)); |
| id_to_find = manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( |
| "xkb:kr:kr104:kor"); |
| - EXPECT_NE(methods->end(), |
| - std::find(methods->begin(), methods->end(), *id_to_find)); |
| + EXPECT_TRUE(IsContained(*methods.get(), *id_to_find)); |
| } |
| TEST_F(InputMethodManagerImplTest, TestSetInputMethodConfig) { |