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
3 // found in the LICENSE file.
5 #ifndef UI_BASE_IME_CHROMEOS_MOCK_IME_ENGINE_HANDLER_H_
6 #define UI_BASE_IME_CHROMEOS_MOCK_IME_ENGINE_HANDLER_H_
8 #include "ui/base/ime/chromeos/ime_bridge.h"
9 #include "ui/base/ime/ui_base_ime_export.h"
10 #include "ui/events/event.h"
14 class UI_BASE_IME_EXPORT MockIMEEngineHandler
15 : public IMEEngineHandlerInterface
{
17 MockIMEEngineHandler();
18 ~MockIMEEngineHandler() override
;
20 void FocusIn(const InputContext
& input_context
) override
;
21 void FocusOut() override
;
22 void Enable(const std::string
& component_id
) override
;
23 void Disable() override
;
24 void PropertyActivate(const std::string
& property_name
) override
;
25 void Reset() override
;
26 bool IsInterestedInKeyEvent() const override
;
27 void ProcessKeyEvent(const ui::KeyEvent
& key_event
,
28 const KeyEventDoneCallback
& callback
) override
;
29 void CandidateClicked(uint32 index
) override
;
30 void SetSurroundingText(const std::string
& text
,
33 uint32 offset_pos
) override
;
34 void SetCompositionBounds(const std::vector
<gfx::Rect
>& bounds
) override
;
36 int focus_in_call_count() const { return focus_in_call_count_
; }
37 int focus_out_call_count() const { return focus_out_call_count_
; }
38 int reset_call_count() const { return reset_call_count_
; }
39 int set_surrounding_text_call_count() const {
40 return set_surrounding_text_call_count_
;
42 int process_key_event_call_count() const {
43 return process_key_event_call_count_
;
46 const InputContext
& last_text_input_context() const {
47 return last_text_input_context_
;
50 std::string
last_activated_property() const {
51 return last_activated_property_
;
54 std::string
last_set_surrounding_text() const {
55 return last_set_surrounding_text_
;
58 uint32
last_set_surrounding_cursor_pos() const {
59 return last_set_surrounding_cursor_pos_
;
62 uint32
last_set_surrounding_anchor_pos() const {
63 return last_set_surrounding_anchor_pos_
;
66 const ui::KeyEvent
* last_processed_key_event() const {
67 return last_processed_key_event_
.get();
70 const KeyEventDoneCallback
& last_passed_callback() const {
71 return last_passed_callback_
;
75 int focus_in_call_count_
;
76 int focus_out_call_count_
;
77 int set_surrounding_text_call_count_
;
78 int process_key_event_call_count_
;
79 int reset_call_count_
;
80 InputContext last_text_input_context_
;
81 std::string last_activated_property_
;
82 std::string last_set_surrounding_text_
;
83 uint32 last_set_surrounding_cursor_pos_
;
84 uint32 last_set_surrounding_anchor_pos_
;
85 scoped_ptr
<ui::KeyEvent
> last_processed_key_event_
;
86 KeyEventDoneCallback last_passed_callback_
;
89 } // namespace chromeos
91 #endif // UI_BASE_IME_CHROMEOS_MOCK_IME_ENGINE_HANDLER_H_