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"
9 MockIMEEngineHandler::MockIMEEngineHandler()
10 : focus_in_call_count_(0),
11 focus_out_call_count_(0),
12 set_surrounding_text_call_count_(0),
13 process_key_event_call_count_(0),
15 last_text_input_context_(ui::TEXT_INPUT_TYPE_NONE,
16 ui::TEXT_INPUT_MODE_DEFAULT),
17 last_set_surrounding_cursor_pos_(0),
18 last_set_surrounding_anchor_pos_(0) {
21 MockIMEEngineHandler::~MockIMEEngineHandler() {
24 void MockIMEEngineHandler::FocusIn(const InputContext& input_context) {
25 last_text_input_context_ = input_context;
26 if (last_text_input_context_.type != ui::TEXT_INPUT_TYPE_NONE)
27 ++focus_in_call_count_;
30 void MockIMEEngineHandler::FocusOut() {
31 if (last_text_input_context_.type != ui::TEXT_INPUT_TYPE_NONE)
32 ++focus_out_call_count_;
33 last_text_input_context_.type = ui::TEXT_INPUT_TYPE_NONE;
36 void MockIMEEngineHandler::Enable() {
39 void MockIMEEngineHandler::Disable() {
42 void MockIMEEngineHandler::PropertyActivate(const std::string& property_name) {
43 last_activated_property_ = property_name;
46 void MockIMEEngineHandler::Reset() {
50 void MockIMEEngineHandler::ProcessKeyEvent(
51 const ui::KeyEvent& key_event,
52 const KeyEventDoneCallback& callback) {
53 ++process_key_event_call_count_;
54 last_processed_key_event_.reset(new ui::KeyEvent(key_event));
55 last_passed_callback_ = callback;
58 void MockIMEEngineHandler::CandidateClicked(uint32 index) {
61 void MockIMEEngineHandler::SetSurroundingText(const std::string& text,
64 ++set_surrounding_text_call_count_;
65 last_set_surrounding_text_ = text;
66 last_set_surrounding_cursor_pos_ = cursor_pos;
67 last_set_surrounding_anchor_pos_ = anchor_pos;
70 } // namespace chromeos