Commit 77e57218 authored by Bao-Duy Tran's avatar Bao-Duy Tran Committed by Chromium LUCI CQ

Remove obsolete unhelpful InputMethodUtilTest.TestIBusInputMethodText.

This test used to check the integrity of legacy config file
input_methods.txt [1] (mainly detecting typos therein). This was approx
9 years ago, before the migration to extension-based input methods.

Nowadays, almost all of input_methods.txt is obsolete. Until recently,
this test had only been checking data that's no longer used. After the
recent refactor to add hermetic-ness [2], this test now only verifies
local test data (!), further highlighting its unhelpfulness.

[1] https://source.chromium.org/chromium/chromium/src/+/master:chromeos/ime/input_methods.txt;drc=8cbe6597e4cc8457f4e33ef2ad189f0553f59f54
[2] https://crrev.com/c/2546667

Bug: 1134465,1134526
Change-Id: I2842465289c0acd1acab217d3031a0327fb9bc88
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2576226
Commit-Queue: Bao-Duy Tran <tranbaoduy@chromium.org>
Reviewed-by: default avatarDavid Vallet <dvallet@chromium.org>
Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834487}
parent 5ad5b3fd
......@@ -791,11 +791,6 @@ void InputMethodUtil::InitXkbInputMethodsForTesting(
ResetInputMethods(imes);
}
const InputMethodUtil::InputMethodIdToDescriptorMap&
InputMethodUtil::GetIdToDescriptorMapForTesting() {
return id_to_descriptor_;
}
InputMethodDescriptor InputMethodUtil::GetFallbackInputMethodDescriptor() {
std::vector<std::string> layouts;
layouts.emplace_back("us");
......
......@@ -160,9 +160,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) InputMethodUtil {
InputMethodType type,
std::vector<std::string>* out_input_method_ids) const;
// Gets the id to descriptor map for testing.
const InputMethodIdToDescriptorMap& GetIdToDescriptorMapForTesting();
private:
// Converts a string sent from IBus IME engines, which is written in English,
// into Chrome's string ID, then pulls internationalized resource string from
......
......@@ -36,7 +36,6 @@ class TestableInputMethodUtil : public InputMethodUtil {
// Change access rights.
using InputMethodUtil::GetInputMethodIdsFromLanguageCodeInternal;
using InputMethodUtil::GetIdToDescriptorMapForTesting;
};
} // namespace
......@@ -386,29 +385,6 @@ TEST_F(InputMethodUtilTest, TestGetLanguageCodesFromInputMethodIds) {
EXPECT_EQ("fr", language_codes[2]);
}
// Test all supported descriptors to detect a typo in input_methods.txt.
TEST_F(InputMethodUtilTest, TestIBusInputMethodText) {
const std::map<std::string, InputMethodDescriptor>& id_to_descriptor =
util_.GetIdToDescriptorMapForTesting();
for (const auto& it : id_to_descriptor) {
const std::string language_code = it.second.language_codes().at(0);
const base::string16 display_name =
l10n_util::GetDisplayNameForLocale(language_code, "en", false);
// Only two formats, like "fr" (lower case) and "en-US" (lower-upper), are
// allowed. See the text file for details.
EXPECT_TRUE(language_code == "fil" || language_code.length() == 2 ||
(language_code.length() == 5 && language_code[2] == '-'))
<< "Invalid language code " << language_code;
EXPECT_TRUE(l10n_util::IsValidLocaleSyntax(language_code))
<< "Invalid language code " << language_code;
EXPECT_FALSE(display_name.empty())
<< "Invalid language code " << language_code;
// On error, GetDisplayNameForLocale() returns the |language_code| as-is.
EXPECT_NE(language_code, base::UTF16ToUTF8(display_name))
<< "Invalid language code " << language_code;
}
}
// Test the input method ID migration.
TEST_F(InputMethodUtilTest, TestInputMethodIDMigration) {
const char* const migration_cases[][2] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment