Commit 1cc42299 authored by Bao-Duy Tran's avatar Bao-Duy Tran Committed by Chromium LUCI CQ

Use minimally correct test data to unfail InputMethodManagerImpl tests.

Some InputMethodManagerImpl tests are failing in specific environments
due to usage of CrOS prod configs. Thanks to preparatory refactorings,
we can now detach tests from legacy input_methods.txt configs for
hermetic-ness, and adjust the data to un-fail two more tests. There
remains one failure though, to be addressed in follow-ups.

This also effectively reduces usage of legacy input_methods.txt [1][2]
(remnant from before the migration to extension-based input methods
circa 2011) and facilitates its complete deprecation.

[1] https://source.chromium.org/chromium/chromium/src/+/master:chromeos/ime/input_methods.txt;drc=5ab33d25bc676b63e4afbcfade6f9265a5f5a3ea
[2] https://source.chromium.org/chromium/chromium/src/+/master:chromeos/ime/gen_input_methods.py;drc=0303b222088853ce1c0af2bbc7f47937746eda97

Bug: 970790, 1134526
Change-Id: If1ff356711bef55521f4391ec0956bd4b619cf75
Cq-Include-Trybots: luci.chrome.try:linux-chromeos-chrome;luci.chromium.try:linux-chromeos-rel,linux-chromeos-dbg;luci.chromium.try:linux_chromium_chromeos_msan_rel_ng
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2554277
Commit-Queue: Bao-Duy Tran <tranbaoduy@chromium.org>
Reviewed-by: default avatarKeith Lee <keithlee@chromium.org>
Reviewed-by: default avatarYuly Novikov <ynovikov@chromium.org>
Reviewed-by: default avatarDavid Vallet <dvallet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833557}
parent e9c304a5
......@@ -141,9 +141,23 @@ class InputMethodManagerImplTest : public BrowserWithTestWindowTest {
std::vector<ComponentExtensionIME> ime_list;
InitImeList(ime_list);
std::set<std::string> login_layout_set = {"us",
"us(intl)",
"us(altgr-intl)",
"us(dvorak)",
"us(dvp)",
"us(colemak)",
"us(workman)",
"us(workman-intl)",
"fr",
"se",
"jp",
"hu"};
auto mock_delegate =
std::make_unique<MockComponentExtensionIMEManagerDelegate>();
mock_delegate->set_ime_list(ime_list);
mock_delegate->set_login_layout_set(login_layout_set);
manager_ = std::make_unique<InputMethodManagerImpl>(
std::make_unique<FakeInputMethodDelegate>(), std::move(mock_delegate),
......
# TODO(crbug.com/970790): Enable this.
-InputMethodManagerImplTest.SetLoginDefaultWithAllowedKeyboardLayouts
-InputMethodManagerImplTest.TestEnableLayoutsNonUsHardwareKeyboard
-InputMethodManagerImplTest.TestEnableMultipleHardwareKeyboardLayout
# TODO(crbug.com/970806): Enable this.
-KeyboardShortcutViewerMetadataTest.ModifyAcceleratorShouldUpdateMetadata
......@@ -800,11 +800,7 @@ static_library("test_support") {
"ime/chromeos/mock_input_method_manager.cc",
"ime/chromeos/mock_input_method_manager.h",
]
deps += [
# Generates a header used by mock_component_extension_ime_manager_delegate.cc
"//chromeos/ime:gencode",
"//ui/base/ime/chromeos",
]
deps += [ "//ui/base/ime/chromeos" ]
}
}
......
......@@ -3,20 +3,13 @@
// found in the LICENSE file.
#include "ui/base/ime/chromeos/mock_component_extension_ime_manager_delegate.h"
#include "chromeos/ime/input_methods.h"
#include "ui/base/ime/chromeos/component_extension_ime_manager.h"
namespace chromeos {
namespace input_method {
MockComponentExtensionIMEManagerDelegate::
MockComponentExtensionIMEManagerDelegate() {
for (const auto& input_method : input_method::kInputMethods) {
if (input_method.is_login_keyboard) {
login_layout_set_.insert(input_method.xkb_layout_id);
}
}
}
MockComponentExtensionIMEManagerDelegate() = default;
MockComponentExtensionIMEManagerDelegate::
~MockComponentExtensionIMEManagerDelegate() = default;
......
......@@ -30,6 +30,9 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS)
void set_ime_list(const std::vector<ComponentExtensionIME>& ime_list) {
ime_list_ = ime_list;
}
void set_login_layout_set(const std::set<std::string>& login_layout_set) {
login_layout_set_ = login_layout_set;
}
private:
std::set<std::string> login_layout_set_;
......
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