| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_ENGINE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "ui/base/ime/chromeos/input_method_descriptor.h" | 14 #include "ui/base/ime/chromeos/input_method_descriptor.h" |
| 15 #include "ui/base/ime/ime_engine_handler_interface.h" | 15 #include "ui/base/ime/ime_engine_handler_interface.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 class IMEEngineHandlerInterface; | 18 class IMEEngineHandlerInterface; |
| 19 class KeyEvent; | 19 class KeyEvent; |
| 20 | 20 } // namespace ui |
| 21 namespace ime { | |
| 22 struct InputMethodMenuItem; | |
| 23 } | |
| 24 } | |
| 25 | 21 |
| 26 namespace chromeos { | 22 namespace chromeos { |
| 27 | 23 |
| 28 class CompositionText; | 24 class CompositionText; |
| 29 | 25 |
| 30 namespace input_method { | |
| 31 class CandidateWindow; | |
| 32 } | |
| 33 | |
| 34 class MockInputMethodEngine : public ui::IMEEngineHandlerInterface { | 26 class MockInputMethodEngine : public ui::IMEEngineHandlerInterface { |
| 35 public: | 27 public: |
| 36 MockInputMethodEngine(); | 28 MockInputMethodEngine(); |
| 37 ~MockInputMethodEngine() override; | 29 ~MockInputMethodEngine() override; |
| 38 | 30 |
| 39 // IMEEngineHandlerInterface overrides. | 31 // IMEEngineHandlerInterface overrides. |
| 40 const std::string& GetActiveComponentId() const override; | 32 const std::string& GetActiveComponentId() const override; |
| 41 bool SetComposition(int context_id, | |
| 42 const char* text, | |
| 43 int selection_start, | |
| 44 int selection_end, | |
| 45 int cursor, | |
| 46 const std::vector<SegmentInfo>& segments, | |
| 47 std::string* error) override; | |
| 48 bool ClearComposition(int context_id, std::string* error) override; | 33 bool ClearComposition(int context_id, std::string* error) override; |
| 49 bool CommitText(int context_id, | 34 bool CommitText(int context_id, |
| 50 const char* text, | 35 const char* text, |
| 51 std::string* error) override; | 36 std::string* error) override; |
| 52 bool SendKeyEvents(int context_id, | |
| 53 const std::vector<KeyboardEvent>& events) override; | |
| 54 const CandidateWindowProperty& GetCandidateWindowProperty() const override; | |
| 55 void SetCandidateWindowProperty( | |
| 56 const CandidateWindowProperty& property) override; | |
| 57 bool SetCandidateWindowVisible(bool visible, std::string* error) override; | 37 bool SetCandidateWindowVisible(bool visible, std::string* error) override; |
| 58 bool SetCandidates(int context_id, | |
| 59 const std::vector<Candidate>& candidates, | |
| 60 std::string* error) override; | |
| 61 bool SetCursorPosition(int context_id, | 38 bool SetCursorPosition(int context_id, |
| 62 int candidate_id, | 39 int candidate_id, |
| 63 std::string* error) override; | 40 std::string* error) override; |
| 64 bool SetMenuItems(const std::vector<MenuItem>& items) override; | |
| 65 bool UpdateMenuItems(const std::vector<MenuItem>& items) override; | |
| 66 bool IsActive() const override; | 41 bool IsActive() const override; |
| 67 bool DeleteSurroundingText(int context_id, | 42 bool DeleteSurroundingText(int context_id, |
| 68 int offset, | 43 int offset, |
| 69 size_t number_of_chars, | 44 size_t number_of_chars, |
| 70 std::string* error) override; | 45 std::string* error) override; |
| 71 | 46 |
| 72 // IMEEngineHandlerInterface overrides. | 47 // IMEEngineHandlerInterface overrides. |
| 73 void FocusIn( | 48 void FocusIn( |
| 74 const IMEEngineHandlerInterface::InputContext& input_context) override; | 49 const IMEEngineHandlerInterface::InputContext& input_context) override; |
| 75 void FocusOut() override; | 50 void FocusOut() override; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 88 void SetCompositionBounds(const std::vector<gfx::Rect>& bounds) override; | 63 void SetCompositionBounds(const std::vector<gfx::Rect>& bounds) override; |
| 89 void HideInputView() override; | 64 void HideInputView() override; |
| 90 | 65 |
| 91 std::string last_activated_property() const { | 66 std::string last_activated_property() const { |
| 92 return last_activated_property_; | 67 return last_activated_property_; |
| 93 } | 68 } |
| 94 | 69 |
| 95 private: | 70 private: |
| 96 std::string active_component_id_; | 71 std::string active_component_id_; |
| 97 | 72 |
| 98 // The current candidate window property. | |
| 99 CandidateWindowProperty candidate_window_property_; | |
| 100 | |
| 101 std::string last_activated_property_; | 73 std::string last_activated_property_; |
| 102 }; | 74 }; |
| 103 | 75 |
| 104 } // namespace chromeos | 76 } // namespace chromeos |
| 105 | 77 |
| 106 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_ | 78 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_ |
| OLD | NEW |