| 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_util.h" | 8 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 9 #include "chromeos/ime/fake_input_method_delegate.h" | 9 #include "chromeos/ime/fake_input_method_delegate.h" |
| 10 #include "chromeos/ime/fake_xkeyboard.h" | 10 #include "chromeos/ime/fake_keyboard_controller.h" |
| 11 #include "chromeos/ime/input_method_manager.h" | 11 #include "chromeos/ime/input_method_manager.h" |
| 12 #include "chromeos/ime/input_method_whitelist.h" | 12 #include "chromeos/ime/input_method_whitelist.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(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 InputMethodDescriptors* result) OVERRIDE; | 53 InputMethodDescriptors* result) OVERRIDE; |
| 54 virtual void SetEnabledExtensionImes(std::vector<std::string>* ids) OVERRIDE; | 54 virtual void SetEnabledExtensionImes(std::vector<std::string>* ids) OVERRIDE; |
| 55 virtual void SetInputMethodLoginDefault() OVERRIDE; | 55 virtual void SetInputMethodLoginDefault() OVERRIDE; |
| 56 virtual bool SwitchToNextInputMethod() OVERRIDE; | 56 virtual bool SwitchToNextInputMethod() OVERRIDE; |
| 57 virtual bool SwitchToPreviousInputMethod( | 57 virtual bool SwitchToPreviousInputMethod( |
| 58 const ui::Accelerator& accelerator) OVERRIDE; | 58 const ui::Accelerator& accelerator) OVERRIDE; |
| 59 virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) OVERRIDE; | 59 virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) OVERRIDE; |
| 60 virtual InputMethodDescriptor GetCurrentInputMethod() const OVERRIDE; | 60 virtual InputMethodDescriptor GetCurrentInputMethod() const OVERRIDE; |
| 61 virtual bool IsISOLevel5ShiftUsedByCurrentInputMethod() const OVERRIDE; | 61 virtual bool IsISOLevel5ShiftUsedByCurrentInputMethod() const OVERRIDE; |
| 62 virtual bool IsAltGrUsedByCurrentInputMethod() const OVERRIDE; | 62 virtual bool IsAltGrUsedByCurrentInputMethod() const OVERRIDE; |
| 63 virtual XKeyboard* GetXKeyboard() OVERRIDE; | 63 virtual KeyboardController* GetKeyboardController() OVERRIDE; |
| 64 virtual InputMethodUtil* GetInputMethodUtil() OVERRIDE; | 64 virtual InputMethodUtil* GetInputMethodUtil() OVERRIDE; |
| 65 virtual ComponentExtensionIMEManager* | 65 virtual ComponentExtensionIMEManager* |
| 66 GetComponentExtensionIMEManager() OVERRIDE; | 66 GetComponentExtensionIMEManager() OVERRIDE; |
| 67 virtual bool IsLoginKeyboard(const std::string& layout) const OVERRIDE; | 67 virtual bool IsLoginKeyboard(const std::string& layout) const OVERRIDE; |
| 68 virtual bool MigrateXkbInputMethods( | 68 virtual bool MigrateXkbInputMethods( |
| 69 std::vector<std::string>* input_method_ids) OVERRIDE; | 69 std::vector<std::string>* input_method_ids) OVERRIDE; |
| 70 | 70 |
| 71 // Sets an input method ID which will be returned by GetCurrentInputMethod(). | 71 // Sets an input method ID which will be returned by GetCurrentInputMethod(). |
| 72 void SetCurrentInputMethodId(const std::string& input_method_id) { | 72 void SetCurrentInputMethodId(const std::string& input_method_id) { |
| 73 current_input_method_id_ = input_method_id; | 73 current_input_method_id_ = input_method_id; |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Set values that will be provided to the InputMethodUtil. | 76 // Set values that will be provided to the InputMethodUtil. |
| 77 void set_application_locale(const std::string& value); | 77 void set_application_locale(const std::string& value); |
| 78 | 78 |
| 79 // Set the value returned by IsISOLevel5ShiftUsedByCurrentInputMethod | 79 // Set the value returned by IsISOLevel5ShiftUsedByCurrentInputMethod |
| 80 void set_mod3_used(bool value) { mod3_used_ = value; } | 80 void set_mod3_used(bool value) { mod3_used_ = value; } |
| 81 | 81 |
| 82 // TODO(yusukes): Add more variables for counting the numbers of the API calls | 82 // TODO(yusukes): Add more variables for counting the numbers of the API calls |
| 83 int add_observer_count_; | 83 int add_observer_count_; |
| 84 int remove_observer_count_; | 84 int remove_observer_count_; |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 // The value GetCurrentInputMethod().id() will return. | 87 // The value GetCurrentInputMethod().id() will return. |
| 88 std::string current_input_method_id_; | 88 std::string current_input_method_id_; |
| 89 | 89 |
| 90 InputMethodWhitelist whitelist_; | 90 InputMethodWhitelist whitelist_; |
| 91 FakeInputMethodDelegate delegate_; // used by util_ | 91 FakeInputMethodDelegate delegate_; // used by util_ |
| 92 InputMethodUtil util_; | 92 InputMethodUtil util_; |
| 93 FakeXKeyboard xkeyboard_; | 93 FakeKeyboardController xkeyboard_; |
| 94 bool mod3_used_; | 94 bool mod3_used_; |
| 95 | 95 |
| 96 // The active input method ids cache (actually default only) | 96 // The active input method ids cache (actually default only) |
| 97 std::vector<std::string> active_input_method_ids_; | 97 std::vector<std::string> active_input_method_ids_; |
| 98 | 98 |
| 99 DISALLOW_COPY_AND_ASSIGN(MockInputMethodManager); | 99 DISALLOW_COPY_AND_ASSIGN(MockInputMethodManager); |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 } // namespace input_method | 102 } // namespace input_method |
| 103 } // namespace chromeos | 103 } // namespace chromeos |
| 104 | 104 |
| 105 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_ | 105 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_ |
| OLD | NEW |