| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 class CompositionText; | 24 class CompositionText; |
| 25 | 25 |
| 26 namespace input_method { | 26 namespace input_method { |
| 27 class CandidateWindow; | 27 class CandidateWindow; |
| 28 struct KeyEventHandle; | 28 struct KeyEventHandle; |
| 29 } | 29 } |
| 30 | 30 |
| 31 class MockInputMethodEngine : public InputMethodEngineInterface { | 31 class MockInputMethodEngine : public InputMethodEngineInterface { |
| 32 public: | 32 public: |
| 33 MockInputMethodEngine(); | 33 MockInputMethodEngine(); |
| 34 virtual ~MockInputMethodEngine(); | 34 ~MockInputMethodEngine() override; |
| 35 | 35 |
| 36 // InputMethodEngineInterface overrides. | 36 // InputMethodEngineInterface overrides. |
| 37 virtual const std::string& GetActiveComponentId() const override; | 37 const std::string& GetActiveComponentId() const override; |
| 38 virtual bool SetComposition(int context_id, | 38 bool SetComposition(int context_id, |
| 39 const char* text, | 39 const char* text, |
| 40 int selection_start, | 40 int selection_start, |
| 41 int selection_end, | 41 int selection_end, |
| 42 int cursor, | 42 int cursor, |
| 43 const std::vector<SegmentInfo>& segments, | 43 const std::vector<SegmentInfo>& segments, |
| 44 std::string* error) override; | 44 std::string* error) override; |
| 45 virtual bool ClearComposition(int context_id, std::string* error) override; | 45 bool ClearComposition(int context_id, std::string* error) override; |
| 46 virtual bool CommitText(int context_id, const char* text, | 46 bool CommitText(int context_id, |
| 47 std::string* error) override; | 47 const char* text, |
| 48 virtual bool SendKeyEvents(int context_id, | 48 std::string* error) override; |
| 49 const std::vector<KeyboardEvent>& events) override; | 49 bool SendKeyEvents(int context_id, |
| 50 virtual const CandidateWindowProperty& | 50 const std::vector<KeyboardEvent>& events) override; |
| 51 GetCandidateWindowProperty() const override; | 51 const CandidateWindowProperty& GetCandidateWindowProperty() const override; |
| 52 virtual void SetCandidateWindowProperty( | 52 void SetCandidateWindowProperty( |
| 53 const CandidateWindowProperty& property) override; | 53 const CandidateWindowProperty& property) override; |
| 54 virtual bool SetCandidateWindowVisible(bool visible, | 54 bool SetCandidateWindowVisible(bool visible, std::string* error) override; |
| 55 std::string* error) override; | 55 bool SetCandidates(int context_id, |
| 56 virtual bool SetCandidates(int context_id, | 56 const std::vector<Candidate>& candidates, |
| 57 const std::vector<Candidate>& candidates, | 57 std::string* error) override; |
| 58 bool SetCursorPosition(int context_id, |
| 59 int candidate_id, |
| 60 std::string* error) override; |
| 61 bool SetMenuItems(const std::vector<MenuItem>& items) override; |
| 62 bool UpdateMenuItems(const std::vector<MenuItem>& items) override; |
| 63 bool IsActive() const override; |
| 64 bool DeleteSurroundingText(int context_id, |
| 65 int offset, |
| 66 size_t number_of_chars, |
| 58 std::string* error) override; | 67 std::string* error) override; |
| 59 virtual bool SetCursorPosition(int context_id, int candidate_id, | |
| 60 std::string* error) override; | |
| 61 virtual bool SetMenuItems(const std::vector<MenuItem>& items) override; | |
| 62 virtual bool UpdateMenuItems(const std::vector<MenuItem>& items) override; | |
| 63 virtual bool IsActive() const override; | |
| 64 virtual bool DeleteSurroundingText(int context_id, | |
| 65 int offset, | |
| 66 size_t number_of_chars, | |
| 67 std::string* error) override; | |
| 68 | 68 |
| 69 // IMEEngineHandlerInterface overrides. | 69 // IMEEngineHandlerInterface overrides. |
| 70 virtual void FocusIn( | 70 void FocusIn( |
| 71 const IMEEngineHandlerInterface::InputContext& input_context) override; | 71 const IMEEngineHandlerInterface::InputContext& input_context) override; |
| 72 virtual void FocusOut() override; | 72 void FocusOut() override; |
| 73 virtual void Enable(const std::string& component_id) override; | 73 void Enable(const std::string& component_id) override; |
| 74 virtual void Disable() override; | 74 void Disable() override; |
| 75 virtual void PropertyActivate(const std::string& property_name) override; | 75 void PropertyActivate(const std::string& property_name) override; |
| 76 virtual void Reset() override; | 76 void Reset() override; |
| 77 virtual void ProcessKeyEvent(const ui::KeyEvent& key_event, | 77 void ProcessKeyEvent(const ui::KeyEvent& key_event, |
| 78 const KeyEventDoneCallback& callback) override; | 78 const KeyEventDoneCallback& callback) override; |
| 79 virtual void CandidateClicked(uint32 index) override; | 79 void CandidateClicked(uint32 index) override; |
| 80 virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos, | 80 void SetSurroundingText(const std::string& text, |
| 81 uint32 anchor_pos) override; | 81 uint32 cursor_pos, |
| 82 virtual void SetCompositionBounds(const gfx::Rect& bounds) override; | 82 uint32 anchor_pos) override; |
| 83 virtual void HideInputView() override; | 83 void SetCompositionBounds(const gfx::Rect& bounds) override; |
| 84 void HideInputView() override; |
| 84 | 85 |
| 85 std::string last_activated_property() const { | 86 std::string last_activated_property() const { |
| 86 return last_activated_property_; | 87 return last_activated_property_; |
| 87 } | 88 } |
| 88 | 89 |
| 89 private: | 90 private: |
| 90 std::string active_component_id_; | 91 std::string active_component_id_; |
| 91 | 92 |
| 92 // The current candidate window property. | 93 // The current candidate window property. |
| 93 CandidateWindowProperty candidate_window_property_; | 94 CandidateWindowProperty candidate_window_property_; |
| 94 | 95 |
| 95 std::string last_activated_property_; | 96 std::string last_activated_property_; |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 } // namespace chromeos | 99 } // namespace chromeos |
| 99 | 100 |
| 100 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_ | 101 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_ |
| OLD | NEW |