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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 class CompositionText; | 26 class CompositionText; |
27 | 27 |
28 namespace input_method { | 28 namespace input_method { |
29 class CandidateWindow; | 29 class CandidateWindow; |
30 struct KeyEventHandle; | 30 struct KeyEventHandle; |
31 } // namespace input_method | 31 } // namespace input_method |
32 | 32 |
33 class MockInputMethodEngine : public InputMethodEngineInterface { | 33 class MockInputMethodEngine : public InputMethodEngineInterface { |
34 public: | 34 public: |
35 explicit MockInputMethodEngine( | 35 explicit MockInputMethodEngine(); |
36 const input_method::InputMethodDescriptor& descriptor); | |
37 virtual ~MockInputMethodEngine(); | 36 virtual ~MockInputMethodEngine(); |
38 | 37 |
39 // InputMethodEngineInterface overrides. | 38 // InputMethodEngineInterface overrides. |
40 virtual const input_method::InputMethodDescriptor& GetDescriptor() | 39 virtual const std::string& GetActiveComponentId() const OVERRIDE; |
41 const OVERRIDE; | |
42 virtual void NotifyImeReady() OVERRIDE; | |
43 virtual bool SetComposition(int context_id, | 40 virtual bool SetComposition(int context_id, |
44 const char* text, | 41 const char* text, |
45 int selection_start, | 42 int selection_start, |
46 int selection_end, | 43 int selection_end, |
47 int cursor, | 44 int cursor, |
48 const std::vector<SegmentInfo>& segments, | 45 const std::vector<SegmentInfo>& segments, |
49 std::string* error) OVERRIDE; | 46 std::string* error) OVERRIDE; |
50 virtual bool ClearComposition(int context_id, std::string* error) OVERRIDE; | 47 virtual bool ClearComposition(int context_id, std::string* error) OVERRIDE; |
51 virtual bool CommitText(int context_id, const char* text, | 48 virtual bool CommitText(int context_id, const char* text, |
52 std::string* error) OVERRIDE; | 49 std::string* error) OVERRIDE; |
(...skipping 15 matching lines...) Expand all Loading... |
68 virtual bool IsActive() const OVERRIDE; | 65 virtual bool IsActive() const OVERRIDE; |
69 virtual bool DeleteSurroundingText(int context_id, | 66 virtual bool DeleteSurroundingText(int context_id, |
70 int offset, | 67 int offset, |
71 size_t number_of_chars, | 68 size_t number_of_chars, |
72 std::string* error) OVERRIDE; | 69 std::string* error) OVERRIDE; |
73 | 70 |
74 // IMEEngineHandlerInterface overrides. | 71 // IMEEngineHandlerInterface overrides. |
75 virtual void FocusIn( | 72 virtual void FocusIn( |
76 const IMEEngineHandlerInterface::InputContext& input_context) OVERRIDE; | 73 const IMEEngineHandlerInterface::InputContext& input_context) OVERRIDE; |
77 virtual void FocusOut() OVERRIDE; | 74 virtual void FocusOut() OVERRIDE; |
78 virtual void Enable() OVERRIDE; | 75 virtual void Enable(const std::string& component_id) OVERRIDE; |
79 virtual void Disable() OVERRIDE; | 76 virtual void Disable() OVERRIDE; |
80 virtual void PropertyActivate(const std::string& property_name) OVERRIDE; | 77 virtual void PropertyActivate(const std::string& property_name) OVERRIDE; |
81 virtual void Reset() OVERRIDE; | 78 virtual void Reset() OVERRIDE; |
82 virtual void ProcessKeyEvent(const ui::KeyEvent& key_event, | 79 virtual void ProcessKeyEvent(const ui::KeyEvent& key_event, |
83 const KeyEventDoneCallback& callback) OVERRIDE; | 80 const KeyEventDoneCallback& callback) OVERRIDE; |
84 virtual void CandidateClicked(uint32 index) OVERRIDE; | 81 virtual void CandidateClicked(uint32 index) OVERRIDE; |
85 virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos, | 82 virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos, |
86 uint32 anchor_pos) OVERRIDE; | 83 uint32 anchor_pos) OVERRIDE; |
87 virtual void HideInputView() OVERRIDE; | 84 virtual void HideInputView() OVERRIDE; |
88 | 85 |
89 std::string last_activated_property() const { | 86 std::string last_activated_property() const { |
90 return last_activated_property_; | 87 return last_activated_property_; |
91 } | 88 } |
92 | 89 |
93 private: | 90 private: |
94 // Descriptor of this input method. | 91 std::string active_component_id_; |
95 input_method::InputMethodDescriptor descriptor_; | |
96 | 92 |
97 // The current candidate window property. | 93 // The current candidate window property. |
98 CandidateWindowProperty candidate_window_property_; | 94 CandidateWindowProperty candidate_window_property_; |
99 | 95 |
100 std::string last_activated_property_; | 96 std::string last_activated_property_; |
101 }; | 97 }; |
102 | 98 |
103 } // namespace chromeos | 99 } // namespace chromeos |
104 | 100 |
105 #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 |