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_ibus_controller.h" |
| 6 |
| 7 #include "chrome/browser/chromeos/input_method/input_method_config.h" |
| 8 #include "chrome/browser/chromeos/input_method/input_method_property.h" |
| 9 |
| 10 namespace chromeos { |
| 11 namespace input_method { |
| 12 |
| 13 MockIBusController::MockIBusController() |
| 14 : start_count_(0), |
| 15 start_return_(true), |
| 16 stop_count_(0), |
| 17 stop_return_(true), |
| 18 change_input_method_count_(0), |
| 19 change_input_method_return_(true), |
| 20 activate_input_method_property_count_(0), |
| 21 activate_input_method_property_return_(true), |
| 22 set_input_method_config_internal_count_(0), |
| 23 set_input_method_config_internal_return_(true) { |
| 24 } |
| 25 |
| 26 MockIBusController::~MockIBusController() { |
| 27 } |
| 28 |
| 29 bool MockIBusController::Start() { |
| 30 ++start_count_; |
| 31 return start_return_; |
| 32 } |
| 33 |
| 34 bool MockIBusController::Stop() { |
| 35 ++stop_count_; |
| 36 return stop_return_; |
| 37 } |
| 38 |
| 39 bool MockIBusController::ChangeInputMethod(const std::string& id) { |
| 40 ++change_input_method_count_; |
| 41 |
| 42 // Emulate IBusController's behavior. |
| 43 if (id != change_input_method_id_) { |
| 44 current_property_list_.clear(); |
| 45 NotifyPropertyChangedForTesting(); |
| 46 } |
| 47 change_input_method_id_ = id; |
| 48 |
| 49 return change_input_method_return_; |
| 50 } |
| 51 |
| 52 bool MockIBusController::ActivateInputMethodProperty(const std::string& key) { |
| 53 ++activate_input_method_property_count_; |
| 54 activate_input_method_property_key_ = key; |
| 55 return activate_input_method_property_return_; |
| 56 } |
| 57 |
| 58 bool MockIBusController::SetInputMethodConfigInternal( |
| 59 const ConfigKeyType& key, |
| 60 const InputMethodConfigValue& value) { |
| 61 ++set_input_method_config_internal_count_; |
| 62 set_input_method_config_internal_key_ = key; |
| 63 set_input_method_config_internal_value_ = value; |
| 64 return set_input_method_config_internal_return_; |
| 65 } |
| 66 |
| 67 } // namespace input_method |
| 68 } // namespace chromeos |
OLD | NEW |