blob: 233f9734f1e71ee7f8de1e560c1ecfeb5f2e2eb7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/base/ime/text_input_test_support.h"
#if defined(OS_CHROMEOS)
#include "base/chromeos/chromeos_version.h"
#include "base/logging.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/ime/ibus_daemon_controller.h"
#endif // OS_CHROMEOS
#if defined(OS_CHROMEOS)
namespace {
bool dbus_thread_manager_was_initialized = false;
}
#endif // OS_CHROMEOS
namespace ui {
void TextInputTestSupport::Initialize() {
#if defined(OS_CHROMEOS)
if (!chromeos::DBusThreadManager::IsInitialized()) {
chromeos::DBusThreadManager::InitializeWithStub();
dbus_thread_manager_was_initialized = true;
}
if (!chromeos::IBusDaemonController::GetInstance()) {
// Passing NULL is okay because IBusDaemonController will be initialized
// with stub implementation on non-ChromeOS device.
DCHECK(!base::chromeos::IsRunningOnChromeOS());
chromeos::IBusDaemonController::Initialize(NULL, NULL);
}
#endif // OS_CHROMEOS
}
void TextInputTestSupport::Shutdown() {
#if defined(OS_CHROMEOS)
if (dbus_thread_manager_was_initialized) {
chromeos::DBusThreadManager::Shutdown();
dbus_thread_manager_was_initialized = false;
}
if (chromeos::IBusDaemonController::GetInstance())
chromeos::IBusDaemonController::Shutdown();
#endif // OS_CHROMEOS
}
} // namespace ui
|