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 "ui/base/ime/chromeos/component_extension_ime_manager.h" |
| 6 |
5 #include <stddef.h> | 7 #include <stddef.h> |
6 | 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/base/ime/chromeos/component_extension_ime_manager.h" | |
11 #include "ui/base/ime/chromeos/extension_ime_util.h" | 13 #include "ui/base/ime/chromeos/extension_ime_util.h" |
12 #include "ui/base/ime/chromeos/mock_component_extension_ime_manager_delegate.h" | 14 #include "ui/base/ime/chromeos/mock_component_extension_ime_manager_delegate.h" |
13 | 15 |
14 namespace chromeos { | 16 namespace chromeos { |
15 namespace input_method { | 17 namespace input_method { |
16 | 18 |
17 namespace { | 19 namespace { |
18 | 20 |
19 class ComponentExtensionIMEManagerTest : public testing::Test { | 21 class ComponentExtensionIMEManagerTest : public testing::Test { |
20 public: | 22 public: |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ext3_engine3.display_name = "ext3_engine3_display_name"; | 109 ext3_engine3.display_name = "ext3_engine3_display_name"; |
108 ext3_engine3.language_codes.push_back("en"); | 110 ext3_engine3.language_codes.push_back("en"); |
109 ext3_engine3.layouts.push_back("us"); | 111 ext3_engine3.layouts.push_back("us"); |
110 ext3.engines.push_back(ext3_engine3); | 112 ext3.engines.push_back(ext3_engine3); |
111 | 113 |
112 ime_list_.push_back(ext3); | 114 ime_list_.push_back(ext3); |
113 | 115 |
114 mock_delegate_ = new MockComponentExtIMEManagerDelegate(); | 116 mock_delegate_ = new MockComponentExtIMEManagerDelegate(); |
115 mock_delegate_->set_ime_list(ime_list_); | 117 mock_delegate_->set_ime_list(ime_list_); |
116 component_ext_mgr_.reset(new ComponentExtensionIMEManager()); | 118 component_ext_mgr_.reset(new ComponentExtensionIMEManager()); |
117 component_ext_mgr_->Initialize(make_scoped_ptr(mock_delegate_)); | 119 component_ext_mgr_->Initialize(base::WrapUnique(mock_delegate_)); |
118 } | 120 } |
119 | 121 |
120 virtual void TearDown() { | 122 virtual void TearDown() { |
121 } | 123 } |
122 | 124 |
123 protected: | 125 protected: |
124 MockComponentExtIMEManagerDelegate* mock_delegate_; | 126 MockComponentExtIMEManagerDelegate* mock_delegate_; |
125 scoped_ptr<ComponentExtensionIMEManager> component_ext_mgr_; | 127 std::unique_ptr<ComponentExtensionIMEManager> component_ext_mgr_; |
126 std::vector<ComponentExtensionIME> ime_list_; | 128 std::vector<ComponentExtensionIME> ime_list_; |
127 | 129 |
128 private: | 130 private: |
129 | 131 |
130 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManagerTest); | 132 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManagerTest); |
131 }; | 133 }; |
132 | 134 |
133 TEST_F(ComponentExtensionIMEManagerTest, LoadComponentExtensionIMETest) { | 135 TEST_F(ComponentExtensionIMEManagerTest, LoadComponentExtensionIMETest) { |
134 for (size_t i = 0; i < ime_list_.size(); ++i) { | 136 for (size_t i = 0; i < ime_list_.size(); ++i) { |
135 for (size_t j = 0; j < ime_list_[i].engines.size(); ++j) { | 137 for (size_t j = 0; j < ime_list_[i].engines.size(); ++j) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } else if (i >= 2 && i < 4) { | 203 } else if (i >= 2 && i < 4) { |
202 EXPECT_TRUE(d.id().find("vkd_") != std::string::npos); | 204 EXPECT_TRUE(d.id().find("vkd_") != std::string::npos); |
203 } | 205 } |
204 } | 206 } |
205 } | 207 } |
206 | 208 |
207 } // namespace | 209 } // namespace |
208 | 210 |
209 } // namespace input_method | 211 } // namespace input_method |
210 } // namespace chromeos | 212 } // namespace chromeos |
OLD | NEW |