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 #include "ui/base/ime/chromeos/mock_ime_engine_handler.h"
6 #include "ui/base/ime/text_input_flags.h"
10 MockIMEEngineHandler::MockIMEEngineHandler()
11 : focus_in_call_count_(0),
12 focus_out_call_count_(0),
13 set_surrounding_text_call_count_(0),
14 process_key_event_call_count_(0),
16 last_text_input_context_(ui::TEXT_INPUT_TYPE_NONE
,
17 ui::TEXT_INPUT_MODE_DEFAULT
,
18 ui::TEXT_INPUT_FLAG_NONE
),
19 last_set_surrounding_cursor_pos_(0),
20 last_set_surrounding_anchor_pos_(0) {
23 MockIMEEngineHandler::~MockIMEEngineHandler() {
26 void MockIMEEngineHandler::FocusIn(const InputContext
& input_context
) {
27 last_text_input_context_
= input_context
;
28 if (last_text_input_context_
.type
!= ui::TEXT_INPUT_TYPE_NONE
)
29 ++focus_in_call_count_
;
32 void MockIMEEngineHandler::FocusOut() {
33 if (last_text_input_context_
.type
!= ui::TEXT_INPUT_TYPE_NONE
)
34 ++focus_out_call_count_
;
35 last_text_input_context_
.type
= ui::TEXT_INPUT_TYPE_NONE
;
38 void MockIMEEngineHandler::Enable(const std::string
& component_id
) {
41 void MockIMEEngineHandler::Disable() {
44 void MockIMEEngineHandler::PropertyActivate(const std::string
& property_name
) {
45 last_activated_property_
= property_name
;
48 void MockIMEEngineHandler::Reset() {
52 bool MockIMEEngineHandler::IsInterestedInKeyEvent() const {
56 void MockIMEEngineHandler::ProcessKeyEvent(
57 const ui::KeyEvent
& key_event
,
58 const KeyEventDoneCallback
& callback
) {
59 ++process_key_event_call_count_
;
60 last_processed_key_event_
.reset(new ui::KeyEvent(key_event
));
61 last_passed_callback_
= callback
;
64 void MockIMEEngineHandler::CandidateClicked(uint32 index
) {
67 void MockIMEEngineHandler::SetSurroundingText(const std::string
& text
,
70 ++set_surrounding_text_call_count_
;
71 last_set_surrounding_text_
= text
;
72 last_set_surrounding_cursor_pos_
= cursor_pos
;
73 last_set_surrounding_anchor_pos_
= anchor_pos
;
76 void MockIMEEngineHandler::SetCompositionBounds(
77 const std::vector
<gfx::Rect
>& bounds
) {
80 } // namespace chromeos