OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" |
| 6 |
| 7 namespace chromeos { |
| 8 namespace input_method { |
| 9 |
| 10 MockInputMethodManager::MockInputMethodManager() |
| 11 : add_observer_count_(0), |
| 12 remove_observer_count_(0), |
| 13 set_state_count_(0), |
| 14 last_state_(STATE_TERMINATING), |
| 15 util_(whitelist_.GetSupportedInputMethods()) { |
| 16 } |
| 17 |
| 18 MockInputMethodManager::~MockInputMethodManager() { |
| 19 } |
| 20 |
| 21 void MockInputMethodManager::AddObserver( |
| 22 InputMethodManager::Observer* observer) { |
| 23 ++add_observer_count_; |
| 24 } |
| 25 |
| 26 void MockInputMethodManager::AddCandidateWindowObserver( |
| 27 InputMethodManager::CandidateWindowObserver* observer) { |
| 28 } |
| 29 |
| 30 void MockInputMethodManager::RemoveObserver( |
| 31 InputMethodManager::Observer* observer) { |
| 32 ++remove_observer_count_; |
| 33 } |
| 34 |
| 35 void MockInputMethodManager::RemoveCandidateWindowObserver( |
| 36 InputMethodManager::CandidateWindowObserver* observer) { |
| 37 } |
| 38 |
| 39 void MockInputMethodManager::SetState(State new_state) { |
| 40 ++set_state_count_; |
| 41 last_state_ = new_state; |
| 42 } |
| 43 |
| 44 InputMethodDescriptors* |
| 45 MockInputMethodManager::GetSupportedInputMethods() const { |
| 46 InputMethodDescriptors* result = new InputMethodDescriptors; |
| 47 result->push_back( |
| 48 InputMethodDescriptor::GetFallbackInputMethodDescriptor()); |
| 49 return result; |
| 50 } |
| 51 |
| 52 InputMethodDescriptors* MockInputMethodManager::GetActiveInputMethods() const { |
| 53 InputMethodDescriptors* result = new InputMethodDescriptors; |
| 54 result->push_back( |
| 55 InputMethodDescriptor::GetFallbackInputMethodDescriptor()); |
| 56 return result; |
| 57 } |
| 58 |
| 59 size_t MockInputMethodManager::GetNumActiveInputMethods() const { |
| 60 return 1; |
| 61 } |
| 62 |
| 63 void MockInputMethodManager::EnableLayouts(const std::string& language_code, |
| 64 const std::string& initial_layout) { |
| 65 } |
| 66 |
| 67 bool MockInputMethodManager::EnableInputMethods( |
| 68 const std::vector<std::string>& new_active_input_method_ids) { |
| 69 return true; |
| 70 } |
| 71 |
| 72 bool MockInputMethodManager::SetInputMethodConfig( |
| 73 const std::string& section, |
| 74 const std::string& config_name, |
| 75 const InputMethodConfigValue& value) { |
| 76 return true; |
| 77 } |
| 78 |
| 79 void MockInputMethodManager::ChangeInputMethod( |
| 80 const std::string& input_method_id) { |
| 81 } |
| 82 |
| 83 void MockInputMethodManager::ActivateInputMethodProperty( |
| 84 const std::string& key) { |
| 85 } |
| 86 |
| 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 } |
| 93 |
| 94 void MockInputMethodManager::RemoveInputMethodExtension(const std::string& id) { |
| 95 } |
| 96 |
| 97 void MockInputMethodManager::EnableHotkeys() { |
| 98 } |
| 99 |
| 100 void MockInputMethodManager::DisableHotkeys() { |
| 101 } |
| 102 |
| 103 bool MockInputMethodManager::SwitchToNextInputMethod() { |
| 104 return true; |
| 105 } |
| 106 |
| 107 bool MockInputMethodManager::SwitchToPreviousInputMethod() { |
| 108 return true; |
| 109 } |
| 110 |
| 111 bool MockInputMethodManager::SwitchInputMethod( |
| 112 const ui::Accelerator& accelerator) { |
| 113 return true; |
| 114 } |
| 115 |
| 116 InputMethodDescriptor MockInputMethodManager::GetCurrentInputMethod() const { |
| 117 InputMethodDescriptor descriptor = |
| 118 InputMethodDescriptor::GetFallbackInputMethodDescriptor(); |
| 119 if (!current_input_method_id_.empty()) { |
| 120 return InputMethodDescriptor(whitelist_, |
| 121 current_input_method_id_, |
| 122 descriptor.name(), |
| 123 descriptor.keyboard_layout(), |
| 124 descriptor.language_code()); |
| 125 } |
| 126 return descriptor; |
| 127 } |
| 128 |
| 129 InputMethodPropertyList |
| 130 MockInputMethodManager::GetCurrentInputMethodProperties() const { |
| 131 return InputMethodPropertyList(); |
| 132 } |
| 133 |
| 134 XKeyboard* MockInputMethodManager::GetXKeyboard() { |
| 135 return &xkeyboard_; |
| 136 } |
| 137 |
| 138 InputMethodUtil* MockInputMethodManager::GetInputMethodUtil() { |
| 139 return &util_; |
| 140 } |
| 141 |
| 142 } // namespace input_method |
| 143 } // namespace chromeos |
OLD | NEW |