Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/ime/input_method_factory.h" | 5 #include "ui/base/ime/input_method_factory.h" |
| 6 | 6 |
| 7 #include "ui/base/ime/mock_input_method.h" | 7 #include "ui/base/ime/mock_input_method.h" |
| 8 | 8 |
| 9 #if defined(OS_CHROMEOS) && defined(USE_X11) | 9 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 10 #include "ui/base/ime/input_method_ibus.h" | 10 #include "ui/base/ime/input_method_ibus.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 if (IsRemoteInputMethodWinRequired(widget)) | 50 if (IsRemoteInputMethodWinRequired(widget)) |
| 51 return CreateRemoteInputMethodWin(delegate); | 51 return CreateRemoteInputMethodWin(delegate); |
| 52 return scoped_ptr<InputMethod>(new InputMethodIMM32(delegate, widget)); | 52 return scoped_ptr<InputMethod>(new InputMethodIMM32(delegate, widget)); |
| 53 #elif defined(USE_AURA) && defined(OS_LINUX) | 53 #elif defined(USE_AURA) && defined(OS_LINUX) |
| 54 return scoped_ptr<InputMethod>(new InputMethodAuraLinux(delegate)); | 54 return scoped_ptr<InputMethod>(new InputMethodAuraLinux(delegate)); |
| 55 #else | 55 #else |
| 56 return scoped_ptr<InputMethod>(new InputMethodMinimal(delegate)); | 56 return scoped_ptr<InputMethod>(new InputMethodMinimal(delegate)); |
| 57 #endif | 57 #endif |
| 58 } | 58 } |
| 59 | 59 |
| 60 void SetUpInputMethodFactoryForTesting() { | 60 void SetUpInputMethodFactoryForTesting() { |
|
bshe
2014/01/13 22:12:25
My tests suffer the same problem as described in:
| |
| 61 if (g_input_method_set_for_testing) | |
| 62 return; | |
| 63 | |
| 61 CHECK(!g_create_input_method_called) | 64 CHECK(!g_create_input_method_called) |
| 62 << "ui::SetUpInputMethodFactoryForTesting was called after use of " | 65 << "ui::SetUpInputMethodFactoryForTesting was called after use of " |
| 63 << "ui::CreateInputMethod. You must call " | 66 << "ui::CreateInputMethod. You must call " |
| 64 << "ui::SetUpInputMethodFactoryForTesting earlier."; | 67 << "ui::SetUpInputMethodFactoryForTesting earlier."; |
| 65 | 68 |
| 66 g_input_method_set_for_testing = true; | 69 g_input_method_set_for_testing = true; |
| 67 } | 70 } |
| 68 | 71 |
| 69 #if defined(OS_WIN) | 72 #if defined(OS_WIN) |
| 70 InputMethod* GetSharedInputMethod() { | 73 InputMethod* GetSharedInputMethod() { |
| 71 if (!g_shared_input_method) | 74 if (!g_shared_input_method) |
| 72 g_shared_input_method = CreateInputMethod(NULL, NULL).release(); | 75 g_shared_input_method = CreateInputMethod(NULL, NULL).release(); |
| 73 return g_shared_input_method; | 76 return g_shared_input_method; |
| 74 } | 77 } |
| 75 | 78 |
| 76 namespace internal { | 79 namespace internal { |
| 77 | 80 |
| 78 void DestroySharedInputMethod() { | 81 void DestroySharedInputMethod() { |
| 79 delete g_shared_input_method; | 82 delete g_shared_input_method; |
| 80 g_shared_input_method = NULL; | 83 g_shared_input_method = NULL; |
| 81 } | 84 } |
| 82 | 85 |
| 83 } // namespace internal | 86 } // namespace internal |
| 84 #endif | 87 #endif |
| 85 | 88 |
| 86 } // namespace ui | 89 } // namespace ui |
| OLD | NEW |