| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 8 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
| 9 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 9 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 10 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" | 10 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" |
| 11 #include "chrome/browser/chromeos/input_method/mock_input_method_delegate.h" | 11 #include "chrome/browser/chromeos/input_method/mock_input_method_delegate.h" |
| 12 #include "chrome/browser/chromeos/input_method/mock_xkeyboard.h" | 12 #include "chrome/browser/chromeos/input_method/mock_xkeyboard.h" |
| 13 | 13 |
| 14 namespace chromeos { | 14 namespace chromeos { |
| 15 namespace input_method { | 15 namespace input_method { |
| 16 | 16 |
| 17 // The mock implementation of InputMethodManager for testing. | 17 // The mock implementation of InputMethodManager for testing. |
| 18 class MockInputMethodManager : public InputMethodManager { | 18 class MockInputMethodManager : public InputMethodManager { |
| 19 public: | 19 public: |
| 20 MockInputMethodManager(); | 20 MockInputMethodManager(); |
| 21 virtual ~MockInputMethodManager(); | 21 virtual ~MockInputMethodManager(); |
| 22 | 22 |
| 23 // InputMethodManager override: | 23 // InputMethodManager override: |
| 24 virtual void AddObserver(InputMethodManager::Observer* observer) OVERRIDE; | 24 virtual void AddObserver(InputMethodManager::Observer* observer) OVERRIDE; |
| 25 virtual void AddCandidateWindowObserver( | 25 virtual void AddCandidateWindowObserver( |
| 26 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; | 26 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; |
| 27 virtual void RemoveObserver(InputMethodManager::Observer* observer) OVERRIDE; | 27 virtual void RemoveObserver(InputMethodManager::Observer* observer) OVERRIDE; |
| 28 virtual void RemoveCandidateWindowObserver( | 28 virtual void RemoveCandidateWindowObserver( |
| 29 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; | 29 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; |
| 30 virtual void SetState(State new_state) OVERRIDE; | |
| 31 virtual scoped_ptr<InputMethodDescriptors> | 30 virtual scoped_ptr<InputMethodDescriptors> |
| 32 GetSupportedInputMethods() const OVERRIDE; | 31 GetSupportedInputMethods() const OVERRIDE; |
| 33 virtual scoped_ptr<InputMethodDescriptors> | 32 virtual scoped_ptr<InputMethodDescriptors> |
| 34 GetActiveInputMethods() const OVERRIDE; | 33 GetActiveInputMethods() const OVERRIDE; |
| 35 virtual size_t GetNumActiveInputMethods() const OVERRIDE; | 34 virtual size_t GetNumActiveInputMethods() const OVERRIDE; |
| 36 virtual void EnableLayouts(const std::string& language_code, | 35 virtual void EnableLayouts(const std::string& language_code, |
| 37 const std::string& initial_layout) OVERRIDE; | 36 const std::string& initial_layout) OVERRIDE; |
| 38 virtual bool EnableInputMethods( | 37 virtual bool EnableInputMethods( |
| 39 const std::vector<std::string>& new_active_input_method_ids) OVERRIDE; | 38 const std::vector<std::string>& new_active_input_method_ids) OVERRIDE; |
| 40 virtual bool SetInputMethodConfig( | 39 virtual bool SetInputMethodConfig( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 67 current_input_method_id_ = input_method_id; | 66 current_input_method_id_ = input_method_id; |
| 68 } | 67 } |
| 69 | 68 |
| 70 // Set values that will be provided to the InputMethodUtil. | 69 // Set values that will be provided to the InputMethodUtil. |
| 71 void set_application_locale(const std::string& value); | 70 void set_application_locale(const std::string& value); |
| 72 void set_hardware_keyboard_layout(const std::string& value); | 71 void set_hardware_keyboard_layout(const std::string& value); |
| 73 | 72 |
| 74 // TODO(yusukes): Add more variables for counting the numbers of the API calls | 73 // TODO(yusukes): Add more variables for counting the numbers of the API calls |
| 75 int add_observer_count_; | 74 int add_observer_count_; |
| 76 int remove_observer_count_; | 75 int remove_observer_count_; |
| 77 int set_state_count_; | |
| 78 State last_state_; | |
| 79 | 76 |
| 80 private: | 77 private: |
| 81 // The value GetCurrentInputMethod().id() will return. | 78 // The value GetCurrentInputMethod().id() will return. |
| 82 std::string current_input_method_id_; | 79 std::string current_input_method_id_; |
| 83 | 80 |
| 84 InputMethodWhitelist whitelist_; | 81 InputMethodWhitelist whitelist_; |
| 85 MockInputMethodDelegate delegate_; // used by util_ | 82 MockInputMethodDelegate delegate_; // used by util_ |
| 86 InputMethodUtil util_; | 83 InputMethodUtil util_; |
| 87 MockXKeyboard xkeyboard_; | 84 MockXKeyboard xkeyboard_; |
| 88 | 85 |
| 89 DISALLOW_COPY_AND_ASSIGN(MockInputMethodManager); | 86 DISALLOW_COPY_AND_ASSIGN(MockInputMethodManager); |
| 90 }; | 87 }; |
| 91 | 88 |
| 92 } // namespace input_method | 89 } // namespace input_method |
| 93 } // namespace chromeos | 90 } // namespace chromeos |
| 94 | 91 |
| 95 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_ | 92 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_ |
| OLD | NEW |