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
,
32 uint32 anchor_pos
) override
;
33 void SetCompositionBounds(const std::vector
<gfx::Rect
>& bounds
) override
;
35 int focus_in_call_count() const { return focus_in_call_count_
; }
36 int focus_out_call_count() const { return focus_out_call_count_
; }
37 int reset_call_count() const { return reset_call_count_
; }
38 int set_surrounding_text_call_count() const {
39 return set_surrounding_text_call_count_
;
41 int process_key_event_call_count() const {
42 return process_key_event_call_count_
;
45 const InputContext
& last_text_input_context() const {
46 return last_text_input_context_
;
49 std::string
last_activated_property() const {
50 return last_activated_property_
;
53 std::string
last_set_surrounding_text() const {
54 return last_set_surrounding_text_
;
57 uint32
last_set_surrounding_cursor_pos() const {
58 return last_set_surrounding_cursor_pos_
;
61 uint32
last_set_surrounding_anchor_pos() const {
62 return last_set_surrounding_anchor_pos_
;
65 const ui::KeyEvent
* last_processed_key_event() const {
66 return last_processed_key_event_
.get();
69 const KeyEventDoneCallback
& last_passed_callback() const {
70 return last_passed_callback_
;
74 int focus_in_call_count_
;
75 int focus_out_call_count_
;
76 int set_surrounding_text_call_count_
;
77 int process_key_event_call_count_
;
78 int reset_call_count_
;
79 InputContext last_text_input_context_
;
80 std::string last_activated_property_
;
81 std::string last_set_surrounding_text_
;
82 uint32 last_set_surrounding_cursor_pos_
;
83 uint32 last_set_surrounding_anchor_pos_
;
84 scoped_ptr
<ui::KeyEvent
> last_processed_key_event_
;
85 KeyEventDoneCallback last_passed_callback_
;
88 } // namespace chromeos
90 #endif // UI_BASE_IME_CHROMEOS_MOCK_IME_ENGINE_HANDLER_H_