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 void ProcessKeyEvent(const ui::KeyEvent
& key_event
,
27 const KeyEventDoneCallback
& callback
) override
;
28 void CandidateClicked(uint32 index
) override
;
29 void SetSurroundingText(const std::string
& text
,
31 uint32 anchor_pos
) override
;
32 void SetCompositionBounds(const std::vector
<gfx::Rect
>& bounds
) override
;
34 int focus_in_call_count() const { return focus_in_call_count_
; }
35 int focus_out_call_count() const { return focus_out_call_count_
; }
36 int reset_call_count() const { return reset_call_count_
; }
37 int set_surrounding_text_call_count() const {
38 return set_surrounding_text_call_count_
;
40 int process_key_event_call_count() const {
41 return process_key_event_call_count_
;
44 const InputContext
& last_text_input_context() const {
45 return last_text_input_context_
;
48 std::string
last_activated_property() const {
49 return last_activated_property_
;
52 std::string
last_set_surrounding_text() const {
53 return last_set_surrounding_text_
;
56 uint32
last_set_surrounding_cursor_pos() const {
57 return last_set_surrounding_cursor_pos_
;
60 uint32
last_set_surrounding_anchor_pos() const {
61 return last_set_surrounding_anchor_pos_
;
64 const ui::KeyEvent
* last_processed_key_event() const {
65 return last_processed_key_event_
.get();
68 const KeyEventDoneCallback
& last_passed_callback() const {
69 return last_passed_callback_
;
73 int focus_in_call_count_
;
74 int focus_out_call_count_
;
75 int set_surrounding_text_call_count_
;
76 int process_key_event_call_count_
;
77 int reset_call_count_
;
78 InputContext last_text_input_context_
;
79 std::string last_activated_property_
;
80 std::string last_set_surrounding_text_
;
81 uint32 last_set_surrounding_cursor_pos_
;
82 uint32 last_set_surrounding_anchor_pos_
;
83 scoped_ptr
<ui::KeyEvent
> last_processed_key_event_
;
84 KeyEventDoneCallback last_passed_callback_
;
87 } // namespace chromeos
89 #endif // UI_BASE_IME_CHROMEOS_MOCK_IME_ENGINE_HANDLER_H_