Index: ui/base/ime/input_method_factory.cc |
diff --git a/ui/base/ime/input_method_factory.cc b/ui/base/ime/input_method_factory.cc |
index 007608353fb88451386900e5c59709bdfe688abd..b4aa3cd9e4a3dc618d98f48bf6ebb225c25e06ba 100644 |
--- a/ui/base/ime/input_method_factory.cc |
+++ b/ui/base/ime/input_method_factory.cc |
@@ -23,6 +23,8 @@ |
namespace { |
+ui::InputMethod* g_input_method_for_testing = nullptr; |
+ |
bool g_input_method_set_for_testing = false; |
bool g_create_input_method_called = false; |
@@ -37,6 +39,12 @@ scoped_ptr<InputMethod> CreateInputMethod( |
if (!g_create_input_method_called) |
g_create_input_method_called = true; |
+ if (g_input_method_for_testing) { |
+ ui::InputMethod* ret = g_input_method_for_testing; |
+ g_input_method_for_testing = nullptr; |
+ return make_scoped_ptr(ret); |
+ } |
+ |
if (g_input_method_set_for_testing) |
return make_scoped_ptr(new MockInputMethod(delegate)); |
@@ -68,4 +76,8 @@ void SetUpInputMethodFactoryForTesting() { |
g_input_method_set_for_testing = true; |
} |
+void SetUpInputMethodForTesting(InputMethod* input_method) { |
+ g_input_method_for_testing = input_method; |
+} |
+ |
} // namespace ui |