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 87c8b63fdda11c858e923a3108e5b40fd9f4758c..90e0da2352e8c2a78852e276b58d7f3506370d55 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 |
@@ -233,11 +233,14 @@ TEST_F(InputMethodManagerImplTest, TestCandidateWindowObserver) { |
TEST_F(InputMethodManagerImplTest, TestObserver) { |
// For http://crbug.com/19655#c11 - (3). browser_state_monitor_unittest.cc is |
// also for the scenario. |
+ std::vector<std::string> keyboard_layouts; |
+ keyboard_layouts.push_back("xkb:us::eng"); |
+ |
TestObserver observer; |
InitComponentExtension(); |
manager_->AddObserver(&observer); |
EXPECT_EQ(0, observer.input_method_changed_count_); |
- manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); |
+ manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
EXPECT_EQ(1, observer.input_method_changed_count_); |
EXPECT_EQ(1, observer.input_method_property_changed_count_); |
manager_->ChangeInputMethod("xkb:us:dvorak:eng"); |
@@ -283,46 +286,73 @@ TEST_F(InputMethodManagerImplTest, TestGetSupportedInputMethods) { |
TEST_F(InputMethodManagerImplTest, TestEnableLayouts) { |
// Currently 5 keyboard layouts are supported for en-US, and 1 for ja. See |
// ibus_input_method.txt. |
+ std::vector<std::string> keyboard_layouts; |
+ |
InitComponentExtension(); |
- manager_->EnableLoginLayouts("en-US", ""); |
+ manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); |
for (size_t i = 0; i < manager_->GetActiveInputMethodIds().size(); ++i) |
LOG(ERROR) << manager_->GetActiveInputMethodIds().at(i); |
// For http://crbug.com/19655#c11 - (5) |
// The hardware keyboard layout "xkb:us::eng" is always active, hence 2U. |
- manager_->EnableLoginLayouts("ja", ""); // Japanese |
+ manager_->EnableLoginLayouts("ja", keyboard_layouts); // Japanese |
EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
} |
TEST_F(InputMethodManagerImplTest, TestEnableLayoutsAndCurrentInputMethod) { |
// For http://crbug.com/329061 |
- manager_->EnableLoginLayouts("en-US", "xkb:se::swe"); |
+ std::vector<std::string> keyboard_layouts; |
+ keyboard_layouts.push_back("xkb:se::swe"); |
+ |
+ manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
const std::string im_id = manager_->GetCurrentInputMethod().id(); |
EXPECT_EQ("xkb:se::swe", im_id); |
} |
TEST_F(InputMethodManagerImplTest, TestEnableLayoutsNonUsHardwareKeyboard) { |
+ std::vector<std::string> keyboard_layouts; |
+ |
// The physical layout is French. |
- delegate_->set_hardware_keyboard_layout("xkb:fr::fra"); |
- manager_->EnableLoginLayouts("en-US", ""); |
+ keyboard_layouts.push_back("xkb:fr::fra"); |
+ delegate_->set_hardware_keyboard_layout(keyboard_layouts); |
+ keyboard_layouts.clear(); |
+ manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
EXPECT_EQ(6U, manager_->GetNumActiveInputMethods()); // 5 + French |
// The physical layout is Japanese. |
- delegate_->set_hardware_keyboard_layout("xkb:jp::jpn"); |
- manager_->EnableLoginLayouts("ja", ""); |
+ keyboard_layouts.push_back("xkb:jp::jpn"); |
+ delegate_->set_hardware_keyboard_layout(keyboard_layouts); |
+ keyboard_layouts.clear(); |
+ manager_->EnableLoginLayouts("ja", keyboard_layouts); |
// "xkb:us::eng" is not needed, hence 1. |
EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); |
// The physical layout is Russian. |
- delegate_->set_hardware_keyboard_layout("xkb:ru::rus"); |
- manager_->EnableLoginLayouts("ru", ""); |
+ keyboard_layouts.push_back("xkb:ru::rus"); |
+ delegate_->set_hardware_keyboard_layout(keyboard_layouts); |
+ keyboard_layouts.clear(); |
+ manager_->EnableLoginLayouts("ru", keyboard_layouts); |
// "xkb:us::eng" only. |
EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); |
EXPECT_EQ("xkb:us::eng", manager_->GetActiveInputMethodIds().front()); |
} |
+TEST_F(InputMethodManagerImplTest, TestEnableMultipleHardwareKeyboardLayout) { |
+ std::vector<std::string> keyboard_layouts; |
+ |
+ // The physical layouts are French and Hungarian. |
+ keyboard_layouts.push_back("xkb:fr::fra"); |
+ keyboard_layouts.push_back("xkb:hu::hun"); |
+ delegate_->set_hardware_keyboard_layout(keyboard_layouts); |
+ keyboard_layouts.clear(); |
+ manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
+ // 5 + French + Hungarian |
+ EXPECT_EQ(7U, manager_->GetNumActiveInputMethods()); |
Alexander Alekseev
2014/02/11 13:36:02
Please add:
keyboard_layouts="xkb:us::eng,xkb:ru:
Seigo Nonaka
2014/02/12 13:21:02
Done.
|
+} |
+ |
TEST_F(InputMethodManagerImplTest, TestActiveInputMethods) { |
- manager_->EnableLoginLayouts("ja", ""); // Japanese |
+ std::vector<std::string> keyboard_layouts; |
+ manager_->EnableLoginLayouts("ja", keyboard_layouts); // Japanese |
EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
scoped_ptr<InputMethodDescriptors> methods( |
manager_->GetActiveInputMethods()); |
@@ -676,8 +706,10 @@ TEST_F(InputMethodManagerImplTest, TestNextInputMethod) { |
TestObserver observer; |
manager_->AddObserver(&observer); |
InitComponentExtension(); |
+ std::vector<std::string> keyboard_layouts; |
+ keyboard_layouts.push_back("xkb:us::eng"); |
// For http://crbug.com/19655#c11 - (1) |
- manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); |
+ manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); |
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
EXPECT_EQ("us", xkeyboard_->last_layout_); |
@@ -715,7 +747,9 @@ TEST_F(InputMethodManagerImplTest, TestPreviousInputMethod) { |
ui::Accelerator keyup_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); |
keyup_accelerator.set_type(ui::ET_KEY_RELEASED); |
- manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); |
+ std::vector<std::string> keyboard_layouts; |
+ keyboard_layouts.push_back("xkb:us::eng"); |
+ manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); |
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
EXPECT_EQ("us", xkeyboard_->last_layout_); |
@@ -788,7 +822,9 @@ TEST_F(InputMethodManagerImplTest, TestSwitchInputMethodWithUsLayouts) { |
TestObserver observer; |
manager_->AddObserver(&observer); |
InitComponentExtension(); |
- manager_->EnableLoginLayouts("en-US", "xkb:us::eng"); |
+ std::vector<std::string> keyboard_layouts; |
+ keyboard_layouts.push_back("xkb:us::eng"); |
+ manager_->EnableLoginLayouts("en-US", keyboard_layouts); |
EXPECT_EQ(5U, manager_->GetNumActiveInputMethods()); |
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
EXPECT_EQ("us", xkeyboard_->last_layout_); |
@@ -825,7 +861,9 @@ TEST_F(InputMethodManagerImplTest, TestSwitchInputMethodWithJpLayout) { |
ui::Accelerator keyup_accelerator(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); |
keyup_accelerator.set_type(ui::ET_KEY_RELEASED); |
- manager_->EnableLoginLayouts("ja", "xkb:us::eng"); |
+ std::vector<std::string> keyboard_layouts; |
+ keyboard_layouts.push_back("xkb:us::eng"); |
+ manager_->EnableLoginLayouts("ja", keyboard_layouts); |
EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
EXPECT_EQ("xkb:us::eng", manager_->GetCurrentInputMethod().id()); |
EXPECT_EQ("us", xkeyboard_->last_layout_); |