Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc

Issue 1136463005: Supports multiple profile in Chrome OS IMF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed test failures. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/run_loop.h" 16 #include "base/run_loop.h"
17 #include "chrome/browser/chromeos/input_method/input_method_engine_interface.h" 17 #include "chrome/browser/chromeos/input_method/input_method_engine_interface.h"
18 #include "chrome/browser/chromeos/input_method/mock_candidate_window_controller. h" 18 #include "chrome/browser/chromeos/input_method/mock_candidate_window_controller. h"
19 #include "chrome/browser/chromeos/input_method/mock_input_method_engine.h" 19 #include "chrome/browser/chromeos/input_method/mock_input_method_engine.h"
20 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/test/base/browser_with_test_window_test.h" 21 #include "chrome/test/base/browser_with_test_window_test.h"
21 #include "chrome/test/base/testing_browser_process.h" 22 #include "chrome/test/base/testing_browser_process.h"
22 #include "chrome/test/base/testing_profile.h" 23 #include "chrome/test/base/testing_profile.h"
23 #include "chrome/test/base/testing_profile_manager.h" 24 #include "chrome/test/base/testing_profile_manager.h"
24 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
25 #include "ui/base/accelerators/accelerator.h" 26 #include "ui/base/accelerators/accelerator.h"
26 #include "ui/base/ime/chromeos/extension_ime_util.h" 27 #include "ui/base/ime/chromeos/extension_ime_util.h"
27 #include "ui/base/ime/chromeos/fake_ime_keyboard.h" 28 #include "ui/base/ime/chromeos/fake_ime_keyboard.h"
28 #include "ui/base/ime/chromeos/fake_input_method_delegate.h" 29 #include "ui/base/ime/chromeos/fake_input_method_delegate.h"
29 #include "ui/base/ime/chromeos/mock_component_extension_ime_manager_delegate.h" 30 #include "ui/base/ime/chromeos/mock_component_extension_ime_manager_delegate.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 164
164 protected: 165 protected:
165 // Helper function to initialize component extension stuff for testing. 166 // Helper function to initialize component extension stuff for testing.
166 void InitComponentExtension() { 167 void InitComponentExtension() {
167 mock_delegate_ = new MockComponentExtIMEManagerDelegate(); 168 mock_delegate_ = new MockComponentExtIMEManagerDelegate();
168 mock_delegate_->set_ime_list(ime_list_); 169 mock_delegate_->set_ime_list(ime_list_);
169 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate(mock_delegate_); 170 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate(mock_delegate_);
170 171
171 // CreateNewState(NULL) returns state with non-empty current_input_method. 172 // CreateNewState(NULL) returns state with non-empty current_input_method.
172 // So SetState() triggers ChangeInputMethod(). 173 // So SetState() triggers ChangeInputMethod().
173 manager_->SetState(manager_->CreateNewState(NULL)); 174 manager_->SetState(
175 manager_->CreateNewState(ProfileManager::GetActiveUserProfile()));
174 176
175 std::vector<std::string> layouts; 177 std::vector<std::string> layouts;
176 layouts.push_back("us"); 178 layouts.push_back("us");
177 std::vector<std::string> languages; 179 std::vector<std::string> languages;
178 languages.push_back("en-US"); 180 languages.push_back("en-US");
179 181
180 // Note, for production, these SetEngineHandler are called when 182 // Note, for production, these SetEngineHandler are called when
181 // IMEEngineHandlerInterface is initialized via 183 // IMEEngineHandlerInterface is initialized via
182 // InitializeComponentextension. 184 // InitializeComponentextension.
183 InputMethodDescriptors descriptors; 185 InputMethodDescriptors descriptors;
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 ASSERT_EQ(4U, input_method_ids.size()); 1363 ASSERT_EQ(4U, input_method_ids.size());
1362 1364
1363 EXPECT_EQ(ImeIdFromEngineId("xkb:us::eng"), input_method_ids[0]); 1365 EXPECT_EQ(ImeIdFromEngineId("xkb:us::eng"), input_method_ids[0]);
1364 EXPECT_EQ(ImeIdFromEngineId("xkb:fr::fra"), input_method_ids[1]); 1366 EXPECT_EQ(ImeIdFromEngineId("xkb:fr::fra"), input_method_ids[1]);
1365 EXPECT_EQ("_comp_ime_asdf_pinyin", input_method_ids[2]); 1367 EXPECT_EQ("_comp_ime_asdf_pinyin", input_method_ids[2]);
1366 EXPECT_EQ(ImeIdFromEngineId("zh-t-i0-pinyin"), input_method_ids[3]); 1368 EXPECT_EQ(ImeIdFromEngineId("zh-t-i0-pinyin"), input_method_ids[3]);
1367 } 1369 }
1368 1370
1369 } // namespace input_method 1371 } // namespace input_method
1370 } // namespace chromeos 1372 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698