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* MockInputMethodManager::GetSupportedInputMethods() { |
| 45 InputMethodDescriptors* result = new InputMethodDescriptors; |
| 46 result->push_back( |
| 47 InputMethodDescriptor::GetFallbackInputMethodDescriptor()); |
| 48 return result; |
| 49 } |
| 50 |
| 51 InputMethodDescriptors* MockInputMethodManager::GetActiveInputMethods() { |
| 52 InputMethodDescriptors* result = new InputMethodDescriptors; |
| 53 result->push_back( |
| 54 InputMethodDescriptor::GetFallbackInputMethodDescriptor()); |
| 55 return result; |
| 56 } |
| 57 |
| 58 size_t MockInputMethodManager::GetNumActiveInputMethods() const { |
| 59 return 1; |
| 60 } |
| 61 |
| 62 void MockInputMethodManager::EnableLayouts(const std::string& language_code, |
| 63 const std::string& initial_layout) { |
| 64 } |
| 65 |
| 66 bool MockInputMethodManager::EnableInputMethods( |
| 67 const std::vector<std::string>& new_active_input_method_ids) { |
| 68 return true; |
| 69 } |
| 70 |
| 71 bool MockInputMethodManager::SetInputMethodConfig( |
| 72 const std::string& section, |
| 73 const std::string& config_name, |
| 74 const InputMethodConfigValue& value) { |
| 75 return true; |
| 76 } |
| 77 |
| 78 void MockInputMethodManager::ChangeInputMethod( |
| 79 const std::string& input_method_id) { |
| 80 } |
| 81 |
| 82 void MockInputMethodManager::ActivateInputMethodProperty( |
| 83 const std::string& key) { |
| 84 } |
| 85 |
| 86 void MockInputMethodManager::AddInputMethodExtension( |
| 87 const std::string& id, |
| 88 const std::string& name, |
| 89 const std::vector<std::string>& layouts, |
| 90 const std::string& language) { |
| 91 } |
| 92 |
| 93 void MockInputMethodManager::RemoveInputMethodExtension(const std::string& id) { |
| 94 } |
| 95 |
| 96 void MockInputMethodManager::EnableHotkeys() { |
| 97 } |
| 98 |
| 99 void MockInputMethodManager::DisableHotkeys() { |
| 100 } |
| 101 |
| 102 bool MockInputMethodManager::SwitchToNextInputMethod() { |
| 103 return true; |
| 104 } |
| 105 |
| 106 bool MockInputMethodManager::SwitchToPreviousInputMethod() { |
| 107 return true; |
| 108 } |
| 109 |
| 110 bool MockInputMethodManager::SwitchInputMethod( |
| 111 const ui::Accelerator& accelerator) { |
| 112 return true; |
| 113 } |
| 114 |
| 115 InputMethodDescriptor MockInputMethodManager::GetCurrentInputMethod() const { |
| 116 InputMethodDescriptor descriptor = |
| 117 InputMethodDescriptor::GetFallbackInputMethodDescriptor(); |
| 118 if (!current_input_method_id_.empty()) { |
| 119 return InputMethodDescriptor(whitelist_, |
| 120 current_input_method_id_, |
| 121 descriptor.name(), |
| 122 descriptor.keyboard_layout(), |
| 123 descriptor.language_code()); |
| 124 } |
| 125 return descriptor; |
| 126 } |
| 127 |
| 128 InputMethodPropertyList |
| 129 MockInputMethodManager::GetCurrentInputMethodProperties() const { |
| 130 return InputMethodPropertyList(); |
| 131 } |
| 132 |
| 133 XKeyboard* MockInputMethodManager::GetXKeyboard() { |
| 134 return &xkeyboard_; |
| 135 } |
| 136 |
| 137 InputMethodUtil* MockInputMethodManager::GetInputMethodUtil() { |
| 138 return &util_; |
| 139 } |
| 140 |
| 141 } // namespace input_method |
| 142 } // namespace chromeos |
OLD | NEW |