| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "chromeos/ime/component_extension_ime_manager.h" | 6 #include "chromeos/ime/component_extension_ime_manager.h" |
| 7 #include "chromeos/ime/extension_ime_util.h" | 7 #include "chromeos/ime/extension_ime_util.h" |
| 8 #include "chromeos/ime/mock_component_extension_ime_manager_delegate.h" | 8 #include "chromeos/ime/mock_component_extension_ime_manager_delegate.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManagerTest); | 129 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManagerTest); |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 TEST_F(ComponentExtensionIMEManagerTest, LoadComponentExtensionIMETest) { | 132 TEST_F(ComponentExtensionIMEManagerTest, LoadComponentExtensionIMETest) { |
| 133 for (size_t i = 0; i < ime_list_.size(); ++i) { | 133 for (size_t i = 0; i < ime_list_.size(); ++i) { |
| 134 for (size_t j = 0; j < ime_list_[i].engines.size(); ++j) { | 134 for (size_t j = 0; j < ime_list_[i].engines.size(); ++j) { |
| 135 const std::string input_method_id = | 135 const std::string input_method_id = |
| 136 extension_ime_util::GetComponentInputMethodID( | 136 extension_ime_util::GetComponentInputMethodID( |
| 137 ime_list_[i].id, | 137 ime_list_[i].id, |
| 138 ime_list_[i].engines[j].engine_id); | 138 ime_list_[i].engines[j].engine_id); |
| 139 component_ext_mgr_->LoadComponentExtensionIME(input_method_id); | 139 component_ext_mgr_->LoadComponentExtensionIME(NULL /* profile */, |
| 140 input_method_id); |
| 140 EXPECT_EQ(ime_list_[i].id, mock_delegate_->last_loaded_extension_id()); | 141 EXPECT_EQ(ime_list_[i].id, mock_delegate_->last_loaded_extension_id()); |
| 141 } | 142 } |
| 142 } | 143 } |
| 143 EXPECT_EQ(9, mock_delegate_->load_call_count()); | 144 EXPECT_EQ(9, mock_delegate_->load_call_count()); |
| 144 } | 145 } |
| 145 | 146 |
| 146 TEST_F(ComponentExtensionIMEManagerTest, UnloadComponentExtensionIMETest) { | 147 TEST_F(ComponentExtensionIMEManagerTest, UnloadComponentExtensionIMETest) { |
| 147 for (size_t i = 0; i < ime_list_.size(); ++i) { | 148 for (size_t i = 0; i < ime_list_.size(); ++i) { |
| 148 for (size_t j = 0; j < ime_list_[i].engines.size(); ++j) { | 149 for (size_t j = 0; j < ime_list_[i].engines.size(); ++j) { |
| 149 const std::string input_method_id = | 150 const std::string input_method_id = |
| 150 extension_ime_util::GetComponentInputMethodID( | 151 extension_ime_util::GetComponentInputMethodID( |
| 151 ime_list_[i].id, | 152 ime_list_[i].id, |
| 152 ime_list_[i].engines[j].engine_id); | 153 ime_list_[i].engines[j].engine_id); |
| 153 component_ext_mgr_->UnloadComponentExtensionIME(input_method_id); | 154 component_ext_mgr_->UnloadComponentExtensionIME(NULL /* profile */, |
| 155 input_method_id); |
| 154 EXPECT_EQ(ime_list_[i].id, mock_delegate_->last_unloaded_extension_id()); | 156 EXPECT_EQ(ime_list_[i].id, mock_delegate_->last_unloaded_extension_id()); |
| 155 } | 157 } |
| 156 } | 158 } |
| 157 EXPECT_EQ(9, mock_delegate_->unload_call_count()); | 159 EXPECT_EQ(9, mock_delegate_->unload_call_count()); |
| 158 } | 160 } |
| 159 | 161 |
| 160 TEST_F(ComponentExtensionIMEManagerTest, IsWhitelistedTest) { | 162 TEST_F(ComponentExtensionIMEManagerTest, IsWhitelistedTest) { |
| 161 EXPECT_TRUE(component_ext_mgr_->IsWhitelisted( | 163 EXPECT_TRUE(component_ext_mgr_->IsWhitelisted( |
| 162 extension_ime_util::GetComponentInputMethodID( | 164 extension_ime_util::GetComponentInputMethodID( |
| 163 ime_list_[0].id, | 165 ime_list_[0].id, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 188 for (size_t i = 0; i < ime_list_.size(); ++i) { | 190 for (size_t i = 0; i < ime_list_.size(); ++i) { |
| 189 total_ime_size += ime_list_[i].engines.size(); | 191 total_ime_size += ime_list_[i].engines.size(); |
| 190 } | 192 } |
| 191 EXPECT_EQ(total_ime_size, descriptors.size()); | 193 EXPECT_EQ(total_ime_size, descriptors.size()); |
| 192 } | 194 } |
| 193 | 195 |
| 194 } // namespace | 196 } // namespace |
| 195 | 197 |
| 196 } // namespace input_method | 198 } // namespace input_method |
| 197 } // namespace chromeos | 199 } // namespace chromeos |
| OLD | NEW |