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..e30bf7e9a2315eff28e3e16ee60c4d5a11e70114 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,9 @@ scoped_ptr<InputMethod> CreateInputMethod( |
if (!g_create_input_method_called) |
g_create_input_method_called = true; |
+ if (g_input_method_for_testing) |
+ return make_scoped_ptr(g_input_method_for_testing); |
James Su
2015/06/12 07:58:50
Not sure if this code is correct. If more than one
Shu Chen
2015/06/12 08:51:31
Done. Doing "g_input_method_for_testing = nullptr;
|
+ |
if (g_input_method_set_for_testing) |
return make_scoped_ptr(new MockInputMethod(delegate)); |
@@ -68,4 +73,8 @@ void SetUpInputMethodFactoryForTesting() { |
g_input_method_set_for_testing = true; |
} |
+void SetUpInputMethodForTesting(InputMethod* input_method) { |
+ g_input_method_for_testing = input_method; |
+} |
+ |
} // namespace ui |