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

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

Issue 118273002: Set the active input method correctly when EnableLayouts is called. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); 287 EXPECT_EQ(5U, manager_->GetNumActiveInputMethods());
288 for (size_t i = 0; i < manager_->GetActiveInputMethodIds().size(); ++i) 288 for (size_t i = 0; i < manager_->GetActiveInputMethodIds().size(); ++i)
289 LOG(ERROR) << manager_->GetActiveInputMethodIds().at(i); 289 LOG(ERROR) << manager_->GetActiveInputMethodIds().at(i);
290 290
291 // For http://crbug.com/19655#c11 - (5) 291 // For http://crbug.com/19655#c11 - (5)
292 // The hardware keyboard layout "xkb:us::eng" is always active, hence 2U. 292 // The hardware keyboard layout "xkb:us::eng" is always active, hence 2U.
293 manager_->EnableLayouts("ja", ""); // Japanese 293 manager_->EnableLayouts("ja", ""); // Japanese
294 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); 294 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods());
295 } 295 }
296 296
297 TEST_F(InputMethodManagerImplTest, TestEnableLayoutsAndCurrentInputMethod) {
298 // For http://crbug.com/329061
299 manager_->EnableLayouts("en-US", "xkb:se::swe");
300 const std::string im_id = manager_->GetCurrentInputMethod().id();
301 EXPECT_EQ("xkb:se::swe", im_id);
302 }
303
297 TEST_F(InputMethodManagerImplTest, TestEnableLayoutsNonUsHardwareKeyboard) { 304 TEST_F(InputMethodManagerImplTest, TestEnableLayoutsNonUsHardwareKeyboard) {
298 // The physical layout is French. 305 // The physical layout is French.
299 delegate_->set_hardware_keyboard_layout("xkb:fr::fra"); 306 delegate_->set_hardware_keyboard_layout("xkb:fr::fra");
300 manager_->EnableLayouts("en-US", ""); 307 manager_->EnableLayouts("en-US", "");
301 EXPECT_EQ(6U, manager_->GetNumActiveInputMethods()); // 5 + French 308 EXPECT_EQ(6U, manager_->GetNumActiveInputMethods()); // 5 + French
302 // The physical layout is Japanese. 309 // The physical layout is Japanese.
303 delegate_->set_hardware_keyboard_layout("xkb:jp::jpn"); 310 delegate_->set_hardware_keyboard_layout("xkb:jp::jpn");
304 manager_->EnableLayouts("ja", ""); 311 manager_->EnableLayouts("ja", "");
305 // "xkb:us::eng" is not needed, hence 1. 312 // "xkb:us::eng" is not needed, hence 1.
306 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); 313 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods());
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 ids.push_back(ext_id2); 1141 ids.push_back(ext_id2);
1135 EXPECT_TRUE(manager_->EnableInputMethods(ids)); 1142 EXPECT_TRUE(manager_->EnableInputMethods(ids));
1136 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); 1143 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods());
1137 EXPECT_EQ(ext_id1, manager_->GetCurrentInputMethod().id()); 1144 EXPECT_EQ(ext_id1, manager_->GetCurrentInputMethod().id());
1138 manager_->ChangeInputMethod(ext_id2); 1145 manager_->ChangeInputMethod(ext_id2);
1139 EXPECT_EQ(ext_id2, manager_->GetCurrentInputMethod().id()); 1146 EXPECT_EQ(ext_id2, manager_->GetCurrentInputMethod().id());
1140 } 1147 }
1141 1148
1142 } // namespace input_method 1149 } // namespace input_method
1143 } // namespace chromeos 1150 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698