OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROMEOS_IME_MOCK_IME_ENGINE_HANDLER_H_ | 5 #ifndef CHROMEOS_IME_MOCK_IME_ENGINE_HANDLER_H_ |
6 #define CHROMEOS_IME_MOCK_IME_ENGINE_HANDLER_H_ | 6 #define CHROMEOS_IME_MOCK_IME_ENGINE_HANDLER_H_ |
7 | 7 |
8 #include "chromeos/ime/ibus_bridge.h" | 8 #include "chromeos/ime/ibus_bridge.h" |
9 | 9 |
10 namespace chromeos { | 10 namespace chromeos { |
11 | 11 |
12 class MockIMEEngineHandler : public IBusEngineHandlerInterface { | 12 class MockIMEEngineHandler : public IBusEngineHandlerInterface { |
13 public: | 13 public: |
14 MockIMEEngineHandler(); | 14 MockIMEEngineHandler(); |
15 virtual ~MockIMEEngineHandler(); | 15 virtual ~MockIMEEngineHandler(); |
16 | 16 |
17 virtual void FocusIn(ibus::TextInputType text_input_type) OVERRIDE; | 17 virtual void FocusIn(ibus::TextInputType text_input_type) OVERRIDE; |
18 virtual void FocusOut() OVERRIDE; | 18 virtual void FocusOut() OVERRIDE; |
19 virtual void Enable() OVERRIDE; | 19 virtual void Enable() OVERRIDE; |
20 virtual void Disable() OVERRIDE; | 20 virtual void Disable() OVERRIDE; |
21 virtual void PropertyActivate(const std::string& property_name) OVERRIDE; | 21 virtual void PropertyActivate(const std::string& property_name) OVERRIDE; |
22 virtual void PropertyShow(const std::string& property_name) OVERRIDE; | 22 virtual void PropertyShow(const std::string& property_name) OVERRIDE; |
23 virtual void PropertyHide(const std::string& property_name) OVERRIDE; | 23 virtual void PropertyHide(const std::string& property_name) OVERRIDE; |
24 virtual void SetCapability(IBusCapability capability) OVERRIDE; | 24 virtual void SetCapability(IBusCapability capability) OVERRIDE; |
25 virtual void Reset() OVERRIDE; | 25 virtual void Reset() OVERRIDE; |
26 virtual void ProcessKeyEvent(uint32 keysym, uint32 keycode, uint32 state, | 26 virtual void ProcessKeyEvent(const std::string& keysym, |
| 27 const std::string& keycode, |
| 28 bool is_key_down, |
| 29 bool is_alt_down, |
| 30 bool is_ctrl_down, |
| 31 bool is_shift_down, |
| 32 bool is_caps_lock_down, |
27 const KeyEventDoneCallback& callback) OVERRIDE; | 33 const KeyEventDoneCallback& callback) OVERRIDE; |
28 virtual void CandidateClicked(uint32 index, ibus::IBusMouseButton button, | 34 virtual void CandidateClicked(uint32 index, ibus::IBusMouseButton button, |
29 uint32 state) OVERRIDE; | 35 uint32 state) OVERRIDE; |
30 virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos, | 36 virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos, |
31 uint32 anchor_pos) OVERRIDE; | 37 uint32 anchor_pos) OVERRIDE; |
32 | 38 |
33 int focus_in_call_count() const { return focus_in_call_count_; } | 39 int focus_in_call_count() const { return focus_in_call_count_; } |
34 int focus_out_call_count() const { return focus_out_call_count_; } | 40 int focus_out_call_count() const { return focus_out_call_count_; } |
35 int reset_call_count() const { return reset_call_count_; } | 41 int reset_call_count() const { return reset_call_count_; } |
36 int set_surrounding_text_call_count() const { | 42 int set_surrounding_text_call_count() const { |
(...skipping 12 matching lines...) Expand all Loading... |
49 } | 55 } |
50 | 56 |
51 uint32 last_set_surrounding_cursor_pos() const { | 57 uint32 last_set_surrounding_cursor_pos() const { |
52 return last_set_surrounding_cursor_pos_; | 58 return last_set_surrounding_cursor_pos_; |
53 } | 59 } |
54 | 60 |
55 uint32 last_set_surrounding_anchor_pos() const { | 61 uint32 last_set_surrounding_anchor_pos() const { |
56 return last_set_surrounding_anchor_pos_; | 62 return last_set_surrounding_anchor_pos_; |
57 } | 63 } |
58 | 64 |
59 uint32 last_processed_keysym() const { | 65 std::string last_processed_keysym() const { |
60 return last_processed_keysym_; | 66 return last_processed_keysym_; |
61 } | 67 } |
62 | 68 |
63 uint32 last_processed_keycode() const { | 69 std::string last_processed_keycode() const { |
64 return last_processed_keycode_; | 70 return last_processed_keycode_; |
65 } | 71 } |
66 | 72 |
67 uint32 last_processed_state() const { | 73 bool last_processed_is_key_down() const { |
68 return last_processed_state_; | 74 return last_processed_is_key_down_; |
| 75 } |
| 76 |
| 77 bool last_processed_is_alt_down() const { |
| 78 return last_processed_is_alt_down_; |
| 79 } |
| 80 |
| 81 bool last_processed_is_ctrl_down() const { |
| 82 return last_processed_is_ctrl_down_; |
| 83 } |
| 84 |
| 85 bool last_processed_is_shift_down() const { |
| 86 return last_processed_is_shift_down_; |
| 87 } |
| 88 |
| 89 bool last_processed_is_caps_lock_down() const { |
| 90 return last_processed_is_caps_lock_down_; |
69 } | 91 } |
70 | 92 |
71 const KeyEventDoneCallback& last_passed_callback() const { | 93 const KeyEventDoneCallback& last_passed_callback() const { |
72 return last_passed_callback_; | 94 return last_passed_callback_; |
73 } | 95 } |
74 | 96 |
75 private: | 97 private: |
76 int focus_in_call_count_; | 98 int focus_in_call_count_; |
77 int focus_out_call_count_; | 99 int focus_out_call_count_; |
78 int set_surrounding_text_call_count_; | 100 int set_surrounding_text_call_count_; |
79 int process_key_event_call_count_; | 101 int process_key_event_call_count_; |
80 int reset_call_count_; | 102 int reset_call_count_; |
81 ibus::TextInputType last_text_input_type_; | 103 ibus::TextInputType last_text_input_type_; |
82 std::string last_set_surrounding_text_; | 104 std::string last_set_surrounding_text_; |
83 uint32 last_set_surrounding_cursor_pos_; | 105 uint32 last_set_surrounding_cursor_pos_; |
84 uint32 last_set_surrounding_anchor_pos_; | 106 uint32 last_set_surrounding_anchor_pos_; |
85 uint32 last_processed_keysym_; | 107 std::string last_processed_keysym_; |
86 uint32 last_processed_keycode_; | 108 std::string last_processed_keycode_; |
87 uint32 last_processed_state_; | 109 bool last_processed_is_key_down_; |
| 110 bool last_processed_is_alt_down_; |
| 111 bool last_processed_is_ctrl_down_; |
| 112 bool last_processed_is_shift_down_; |
| 113 bool last_processed_is_caps_lock_down_; |
88 KeyEventDoneCallback last_passed_callback_; | 114 KeyEventDoneCallback last_passed_callback_; |
89 }; | 115 }; |
90 | 116 |
91 } // namespace chromeos | 117 } // namespace chromeos |
92 | 118 |
93 #endif // CHROMEOS_IME_MOCK_IME_ENGINE_HANDLER_H_ | 119 #endif // CHROMEOS_IME_MOCK_IME_ENGINE_HANDLER_H_ |
OLD | NEW |