| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_initializer.h" | 5 #include "ui/base/ime/input_method_initializer.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_CHROMEOS) | 9 #if defined(OS_CHROMEOS) |
| 10 #include "ui/base/ime/ime_bridge.h" | 10 #include "ui/base/ime/ime_bridge.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 } | 36 } |
| 37 | 37 |
| 38 void InitializeInputMethodForTesting() { | 38 void InitializeInputMethodForTesting() { |
| 39 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
| 40 IMEBridge::Initialize(); | 40 IMEBridge::Initialize(); |
| 41 #elif defined(USE_AURA) && defined(OS_LINUX) | 41 #elif defined(USE_AURA) && defined(OS_LINUX) |
| 42 if (!g_linux_input_method_context_factory) | 42 if (!g_linux_input_method_context_factory) |
| 43 g_linux_input_method_context_factory = new FakeInputMethodContextFactory(); | 43 g_linux_input_method_context_factory = new FakeInputMethodContextFactory(); |
| 44 const LinuxInputMethodContextFactory* factory = | 44 const LinuxInputMethodContextFactory* factory = |
| 45 LinuxInputMethodContextFactory::instance(); | 45 LinuxInputMethodContextFactory::instance(); |
| 46 CHECK(!factory || factory == g_linux_input_method_context_factory) | 46 // LinuxInputMethodContextFactory was already initialized somewhere else. |
| 47 << "LinuxInputMethodContextFactory was already initialized somewhere " | 47 CHECK(!factory || factory == g_linux_input_method_context_factory); |
| 48 << "else."; | |
| 49 LinuxInputMethodContextFactory::SetInstance( | 48 LinuxInputMethodContextFactory::SetInstance( |
| 50 g_linux_input_method_context_factory); | 49 g_linux_input_method_context_factory); |
| 51 #endif | 50 #endif |
| 52 } | 51 } |
| 53 | 52 |
| 54 void ShutdownInputMethodForTesting() { | 53 void ShutdownInputMethodForTesting() { |
| 55 #if defined(OS_CHROMEOS) | 54 #if defined(OS_CHROMEOS) |
| 56 IMEBridge::Shutdown(); | 55 IMEBridge::Shutdown(); |
| 57 #elif defined(USE_AURA) && defined(OS_LINUX) | 56 #elif defined(USE_AURA) && defined(OS_LINUX) |
| 58 const LinuxInputMethodContextFactory* factory = | 57 const LinuxInputMethodContextFactory* factory = |
| 59 LinuxInputMethodContextFactory::instance(); | 58 LinuxInputMethodContextFactory::instance(); |
| 60 CHECK(!factory || factory == g_linux_input_method_context_factory) | 59 // An unknown LinuxInputMethodContextFactory was set. |
| 61 << "An unknown LinuxInputMethodContextFactory was set."; | 60 CHECK(!factory || factory == g_linux_input_method_context_factory); |
| 62 LinuxInputMethodContextFactory::SetInstance(NULL); | 61 LinuxInputMethodContextFactory::SetInstance(NULL); |
| 63 delete g_linux_input_method_context_factory; | 62 delete g_linux_input_method_context_factory; |
| 64 g_linux_input_method_context_factory = NULL; | 63 g_linux_input_method_context_factory = NULL; |
| 65 #endif | 64 #endif |
| 66 } | 65 } |
| 67 | 66 |
| 68 } // namespace ui | 67 } // namespace ui |
| OLD | NEW |