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
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h"
8 namespace input_method
{
10 MockInputMethodManager::MockInputMethodManager()
11 : add_observer_count_(0),
12 remove_observer_count_(0),
14 last_state_(STATE_TERMINATING
),
15 util_(whitelist_
.GetSupportedInputMethods()) {
18 MockInputMethodManager::~MockInputMethodManager() {
21 void MockInputMethodManager::AddObserver(
22 InputMethodManager::Observer
* observer
) {
23 ++add_observer_count_
;
26 void MockInputMethodManager::AddCandidateWindowObserver(
27 InputMethodManager::CandidateWindowObserver
* observer
) {
30 void MockInputMethodManager::RemoveObserver(
31 InputMethodManager::Observer
* observer
) {
32 ++remove_observer_count_
;
35 void MockInputMethodManager::RemoveCandidateWindowObserver(
36 InputMethodManager::CandidateWindowObserver
* observer
) {
39 void MockInputMethodManager::SetState(State new_state
) {
41 last_state_
= new_state
;
44 InputMethodDescriptors
*
45 MockInputMethodManager::GetSupportedInputMethods() const {
46 InputMethodDescriptors
* result
= new InputMethodDescriptors
;
48 InputMethodDescriptor::GetFallbackInputMethodDescriptor());
52 InputMethodDescriptors
* MockInputMethodManager::GetActiveInputMethods() const {
53 InputMethodDescriptors
* result
= new InputMethodDescriptors
;
55 InputMethodDescriptor::GetFallbackInputMethodDescriptor());
59 size_t MockInputMethodManager::GetNumActiveInputMethods() const {
63 void MockInputMethodManager::EnableLayouts(const std::string
& language_code
,
64 const std::string
& initial_layout
) {
67 bool MockInputMethodManager::EnableInputMethods(
68 const std::vector
<std::string
>& new_active_input_method_ids
) {
72 bool MockInputMethodManager::SetInputMethodConfig(
73 const std::string
& section
,
74 const std::string
& config_name
,
75 const InputMethodConfigValue
& value
) {
79 void MockInputMethodManager::ChangeInputMethod(
80 const std::string
& input_method_id
) {
83 void MockInputMethodManager::ActivateInputMethodProperty(
84 const std::string
& key
) {
87 void MockInputMethodManager::AddInputMethodExtension(
88 const std::string
& id
,
89 const std::string
& name
,
90 const std::vector
<std::string
>& layouts
,
91 const std::string
& language
,
92 InputMethodEngine
* instance
) {
95 void MockInputMethodManager::RemoveInputMethodExtension(const std::string
& id
) {
98 void MockInputMethodManager::GetInputMethodExtensions(
99 InputMethodDescriptors
* result
) {
102 void MockInputMethodManager::SetFilteredExtensionImes(
103 std::vector
<std::string
>* ids
) {
106 bool MockInputMethodManager::SwitchToNextInputMethod() {
110 bool MockInputMethodManager::SwitchToPreviousInputMethod() {
114 bool MockInputMethodManager::SwitchInputMethod(
115 const ui::Accelerator
& accelerator
) {
119 InputMethodDescriptor
MockInputMethodManager::GetCurrentInputMethod() const {
120 InputMethodDescriptor descriptor
=
121 InputMethodDescriptor::GetFallbackInputMethodDescriptor();
122 if (!current_input_method_id_
.empty()) {
123 return InputMethodDescriptor(current_input_method_id_
,
125 descriptor
.keyboard_layout(),
126 descriptor
.language_code(),
132 InputMethodPropertyList
133 MockInputMethodManager::GetCurrentInputMethodProperties() const {
134 return InputMethodPropertyList();
137 XKeyboard
* MockInputMethodManager::GetXKeyboard() {
141 InputMethodUtil
* MockInputMethodManager::GetInputMethodUtil() {
145 } // namespace input_method
146 } // namespace chromeos