| Index: chrome/browser/chromeos/login/oobe_localization_browsertest.cc
|
| diff --git a/chrome/browser/chromeos/login/oobe_localization_browsertest.cc b/chrome/browser/chromeos/login/oobe_localization_browsertest.cc
|
| index 7a6a64b45fcaa93536b74c06bc01a629470dce81..c06d56e27be6d61cd21ec568a6d4a52e75a560b7 100644
|
| --- a/chrome/browser/chromeos/login/oobe_localization_browsertest.cc
|
| +++ b/chrome/browser/chromeos/login/oobe_localization_browsertest.cc
|
| @@ -212,6 +212,23 @@ std::string OobeLocalizationTest::DumpOptions(const char* select_id) {
|
| return checker.GetString(expression);
|
| }
|
|
|
| +std::string TranslateXKB2Extension(const std::string& src) {
|
| + std::string result(src);
|
| + if (!extension_ime_util::UseWrappedExtensionKeyboardLayouts())
|
| + return result;
|
| + // Modifies the expected keyboard select control options for the new
|
| + // extension based xkb id.
|
| + size_t pos = 0;
|
| + std::string repl_old = "xkb:";
|
| + std::string repl_new =
|
| + extension_ime_util::GetInputMethodIDByKeyboardLayout("xkb:");
|
| + while ((pos = result.find(repl_old, pos)) != std::string::npos) {
|
| + result.replace(pos, repl_old.length(), repl_new);
|
| + pos += repl_new.length();
|
| + }
|
| + return result;
|
| +}
|
| +
|
| void OobeLocalizationTest::RunLocalizationTest(
|
| const std::string& initial_locale,
|
| const std::string& keyboard_layout,
|
| @@ -232,20 +249,8 @@ void OobeLocalizationTest::RunLocalizationTest(
|
| ->GetInputMethodUtil()
|
| ->InitXkbInputMethodsForTesting();
|
|
|
| - std::string expected_keyboard_select = expected_keyboard_select_control;
|
| - if (extension_ime_util::UseWrappedExtensionKeyboardLayouts()) {
|
| - // Modifies the expected keyboard select control options for the new
|
| - // extension based xkb id.
|
| - size_t pos = 0;
|
| - std::string repl_old = "xkb:";
|
| - std::string repl_new =
|
| - extension_ime_util::GetInputMethodIDByKeyboardLayout("xkb:");
|
| - while ((pos = expected_keyboard_select.find(repl_old, pos)) !=
|
| - std::string::npos) {
|
| - expected_keyboard_select.replace(pos, repl_old.length(), repl_new);
|
| - pos += repl_new.length();
|
| - }
|
| - }
|
| + const std::string expected_keyboard_select =
|
| + TranslateXKB2Extension(expected_keyboard_select_control);
|
|
|
| // Bring up the OOBE network screen.
|
| chromeos::ShowLoginWizard(chromeos::WizardController::kNetworkScreenName);
|
| @@ -259,8 +264,7 @@ void OobeLocalizationTest::RunLocalizationTest(
|
|
|
| VerifyInitialOptions(kLocaleSelect, expected_locale.c_str(), true);
|
| VerifyInitialOptions(kKeyboardSelect,
|
| - extension_ime_util::GetInputMethodIDByKeyboardLayout(
|
| - expected_keyboard_layout).c_str(),
|
| + TranslateXKB2Extension(expected_keyboard_layout).c_str(),
|
| false);
|
|
|
| // Make sure we have a fallback keyboard.
|
| @@ -335,4 +339,15 @@ IN_PROC_BROWSER_TEST_F(OobeLocalizationTest, NetworkScreenMultipleLocales) {
|
| "xkb:us::eng");
|
| }
|
|
|
| +IN_PROC_BROWSER_TEST_F(OobeLocalizationTest, NetworkScreenRegionalLocales) {
|
| + RunLocalizationTest("fr-CH,it-CH,de-CH",
|
| + "xkb:fr::fra,xkb:it::ita,xkb:de::ger",
|
| + "fr-CH,it-CH,de-CH",
|
| + "xkb:fr::fra,xkb:it::ita,xkb:de::ger",
|
| + "xkb:fr::fra,xkb:it::ita,xkb:de::ger,["
|
| + "xkb:be::fra,xkb:ca::fra,xkb:ch:fr:fra,"
|
| + "xkb:ca:multix:fra,xkb:us::eng"
|
| + "]");
|
| +}
|
| +
|
| } // namespace chromeos
|
|
|